mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-12 22:17:44 +00:00
Compare commits
3 Commits
@revanced/
...
@revanced/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
887ee85e41 | ||
|
|
c9b788dc51 | ||
|
|
ab62e55e76 |
@@ -1,3 +1,5 @@
|
||||
# @revanced/bot-websocket-api [1.0.0-dev.7](https://github.com/revanced/revanced-helper/compare/@revanced/bot-websocket-api@1.0.0-dev.6...@revanced/bot-websocket-api@1.0.0-dev.7) (2024-07-30)
|
||||
|
||||
# @revanced/bot-websocket-api [1.0.0-dev.6](https://github.com/revanced/revanced-helper/compare/@revanced/bot-websocket-api@1.0.0-dev.5...@revanced/bot-websocket-api@1.0.0-dev.6) (2024-07-30)
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@revanced/bot-websocket-api",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"version": "1.0.0-dev.6",
|
||||
"version": "1.0.0-dev.7",
|
||||
"description": "🧦 WebSocket API server for bots assisting ReVanced",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -11,7 +11,6 @@ await Bun.build({
|
||||
entrypoints: ['./src/index.ts'],
|
||||
outdir: './dist',
|
||||
target: 'bun',
|
||||
minify: true,
|
||||
sourcemap: 'external',
|
||||
})
|
||||
|
||||
@@ -21,7 +20,6 @@ await Bun.build({
|
||||
external: ['tesseract.js-core/*'],
|
||||
target: 'bun',
|
||||
outdir: './dist/worker',
|
||||
minify: true,
|
||||
sourcemap: 'external',
|
||||
})
|
||||
|
||||
|
||||
@@ -12,11 +12,6 @@ await Bun.build({
|
||||
outdir: './dist/src',
|
||||
target: 'bun',
|
||||
external: ['./config.js'],
|
||||
minify: {
|
||||
syntax: true,
|
||||
whitespace: true,
|
||||
identifiers: false,
|
||||
},
|
||||
sourcemap: 'external',
|
||||
})
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ withContext(on, 'messageCreate', async (context, msg) => {
|
||||
|
||||
if (msg.author.bot) return
|
||||
|
||||
const regex = new RegExp(`^(?:${config.prefix}|${msg.client.user.toString()}\\s*)([a-zA-Z-_]+)(?:\\s+)?(.+)?`)
|
||||
const regex = new RegExp(
|
||||
`^(?:${config.prefix ? `${escapeRegexSpecials(config.prefix)}|` : ''}${msg.client.user.toString()}\\s*)([a-zA-Z-_]+)(?:\\s+)?(.+)?`,
|
||||
)
|
||||
const matches = msg.content.match(regex)
|
||||
|
||||
if (!matches) return
|
||||
@@ -51,3 +53,12 @@ withContext(on, 'messageCreate', async (context, msg) => {
|
||||
await msg.reply({ embeds: [err instanceof CommandError ? err.toEmbed() : createStackTraceEmbed(err)] })
|
||||
}
|
||||
})
|
||||
|
||||
const escapeRegexSpecials = (str: string): string => {
|
||||
let escapedStr = ''
|
||||
for (const char of str) {
|
||||
if (['.', '+', '*', '?', '$', '(', ')', '[', ']', '{', '}', '|', '\\'].includes(char)) escapedStr += `\\${char}`
|
||||
else escapedStr += char
|
||||
}
|
||||
return escapedStr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user