mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-12 06:06:21 +00:00
Compare commits
7 Commits
@revanced/
...
@revanced/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
887ee85e41 | ||
|
|
c9b788dc51 | ||
|
|
ab62e55e76 | ||
|
|
8f83687b7c | ||
|
|
a60c60c0f9 | ||
|
|
95a122a225 | ||
|
|
d234d79310 |
@@ -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)
|
# @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",
|
"name": "@revanced/bot-websocket-api",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.0-dev.6",
|
"version": "1.0.0-dev.7",
|
||||||
"description": "🧦 WebSocket API server for bots assisting ReVanced",
|
"description": "🧦 WebSocket API server for bots assisting ReVanced",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ await Bun.build({
|
|||||||
entrypoints: ['./src/index.ts'],
|
entrypoints: ['./src/index.ts'],
|
||||||
outdir: './dist',
|
outdir: './dist',
|
||||||
target: 'bun',
|
target: 'bun',
|
||||||
minify: true,
|
|
||||||
sourcemap: 'external',
|
sourcemap: 'external',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@ await Bun.build({
|
|||||||
external: ['tesseract.js-core/*'],
|
external: ['tesseract.js-core/*'],
|
||||||
target: 'bun',
|
target: 'bun',
|
||||||
outdir: './dist/worker',
|
outdir: './dist/worker',
|
||||||
minify: true,
|
|
||||||
sourcemap: 'external',
|
sourcemap: 'external',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
|
# @revanced/discord-bot [1.0.0-dev.12](https://github.com/revanced/revanced-helper/compare/@revanced/discord-bot@1.0.0-dev.11...@revanced/discord-bot@1.0.0-dev.12) (2024-07-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **bots/discord:** deployment runtime errors due to minification ([a60c60c](https://github.com/revanced/revanced-helper/commit/a60c60c0f994a4c256b7d0582e99a1731209cf49))
|
||||||
|
|
||||||
|
# @revanced/discord-bot [1.0.0-dev.11](https://github.com/revanced/revanced-helper/compare/@revanced/discord-bot@1.0.0-dev.10...@revanced/discord-bot@1.0.0-dev.11) (2024-07-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **bots/discord:** reset counter when reconnected to api, redo message scan filter logic ([d234d79](https://github.com/revanced/revanced-helper/commit/d234d79310caed9c43e14a905f9ef46a110e071d))
|
||||||
|
|
||||||
# @revanced/discord-bot [1.0.0-dev.10](https://github.com/revanced/revanced-helper/compare/@revanced/discord-bot@1.0.0-dev.9...@revanced/discord-bot@1.0.0-dev.10) (2024-07-30)
|
# @revanced/discord-bot [1.0.0-dev.10](https://github.com/revanced/revanced-helper/compare/@revanced/discord-bot@1.0.0-dev.9...@revanced/discord-bot@1.0.0-dev.10) (2024-07-30)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "@revanced/discord-bot",
|
"name": "@revanced/discord-bot",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.0-dev.10",
|
"version": "1.0.0-dev.12",
|
||||||
"description": "🤖 Discord bot assisting ReVanced",
|
"description": "🤖 Discord bot assisting ReVanced",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ await Bun.build({
|
|||||||
outdir: './dist/src',
|
outdir: './dist/src',
|
||||||
target: 'bun',
|
target: 'bun',
|
||||||
external: ['./config.js'],
|
external: ['./config.js'],
|
||||||
minify: true,
|
|
||||||
sourcemap: 'external',
|
sourcemap: 'external',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
import { on, withContext } from '$utils/api/events'
|
import { on, withContext } from '$utils/api/events'
|
||||||
|
|
||||||
withContext(on, 'ready', ({ logger }) => void logger.info('Connected to the bot API'))
|
withContext(on, 'ready', ({ api, logger }) => {
|
||||||
|
// Reset disconnect count, so it doesn't meet the threshold for an accidental disconnect
|
||||||
|
api.disconnectCount = 0
|
||||||
|
logger.info('Connected to the bot API')
|
||||||
|
})
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ withContext(on, 'messageCreate', async (context, msg) => {
|
|||||||
|
|
||||||
if (msg.author.bot) return
|
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)
|
const matches = msg.content.match(regex)
|
||||||
|
|
||||||
if (!matches) return
|
if (!matches) return
|
||||||
@@ -51,3 +53,12 @@ withContext(on, 'messageCreate', async (context, msg) => {
|
|||||||
await msg.reply({ embeds: [err instanceof CommandError ? err.toEmbed() : createStackTraceEmbed(err)] })
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -113,15 +113,24 @@ export const messageMatchesFilter = (message: Message, filter: NonNullable<Confi
|
|||||||
if (!filter) return true
|
if (!filter) return true
|
||||||
|
|
||||||
const memberRoles = new Set(message.member?.roles.cache.keys())
|
const memberRoles = new Set(message.member?.roles.cache.keys())
|
||||||
const blFilter = filter.blacklist
|
const { blacklist, whitelist } = filter
|
||||||
|
|
||||||
// If matches blacklist, will return false
|
// If matches only blacklist, will return false
|
||||||
// Any other case, will return true
|
// If matches whitelist but also matches blacklist, will return false
|
||||||
return !(
|
// If matches only whitelist, will return true
|
||||||
blFilter &&
|
// If matches neither, will return true
|
||||||
(blFilter.channels?.includes(message.channelId) ||
|
return (
|
||||||
blFilter.roles?.some(role => memberRoles.has(role)) ||
|
(whitelist
|
||||||
blFilter.users?.includes(message.author.id))
|
? whitelist.channels?.includes(message.channelId) ||
|
||||||
|
whitelist.roles?.some(role => memberRoles.has(role)) ||
|
||||||
|
whitelist.users?.includes(message.author.id)
|
||||||
|
: true) &&
|
||||||
|
!(
|
||||||
|
blacklist &&
|
||||||
|
(blacklist.channels?.includes(message.channelId) ||
|
||||||
|
blacklist.roles?.some(role => memberRoles.has(role)) ||
|
||||||
|
blacklist.users?.includes(message.author.id))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
],
|
],
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"@semantic-release/npm@12.0.1": "patches/@semantic-release%2Fnpm@12.0.1.patch",
|
"@semantic-release/npm@12.0.1": "patches/@semantic-release%2Fnpm@12.0.1.patch",
|
||||||
"drizzle-kit@0.22.8": "patches/drizzle-kit@0.22.8.patch"
|
"drizzle-kit@0.22.8": "patches/drizzle-kit@0.22.8.patch",
|
||||||
|
"decancer@3.2.3": "patches/decancer@3.2.3.patch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
patches/decancer@3.2.3.patch
Normal file
13
patches/decancer@3.2.3.patch
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/src/lib.js b/src/lib.js
|
||||||
|
index de45d7dbe82975b09eff3742d0718accae2107fc..0575daa03dfabdd5c96928458ff4270cb8f7188a 100644
|
||||||
|
--- a/src/lib.js
|
||||||
|
+++ b/src/lib.js
|
||||||
|
@@ -42,7 +42,7 @@ function isMusl() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBinding(name) {
|
||||||
|
- const path = join(__dirname, '..', `decancer.${name}.node`)
|
||||||
|
+ const path = join(import.meta.dir, '..', `decancer.${name}.node`)
|
||||||
|
|
||||||
|
return require(existsSync(path) ? path : `@vierofernando/decancer-${name}`)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user