mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-25 20:21:02 +00:00
feat(bots/discord): framework changes and new features
- Migrated to a new command framework which looks better and works better - Fixed commands not being bundled correctly - Added message (prefix) commands with argument validation - Added a new CommandErrorType, for invalid arguments - `/eval` is now a bit safer - Corrected colors for the coinflip embed - `/stop` now works even when the bot is not connected to the API
This commit is contained in:
@@ -6,19 +6,19 @@ import { createLogger } from '@revanced/bot-shared'
|
||||
import { Client as DiscordClient, Partials } from 'discord.js'
|
||||
import { drizzle } from 'drizzle-orm/bun-sqlite'
|
||||
|
||||
// Export config first, as commands require them
|
||||
// Export some things first, as commands require them
|
||||
import config from '../config.js'
|
||||
export { config }
|
||||
|
||||
import * as commands from './commands'
|
||||
import * as schemas from './database/schemas'
|
||||
|
||||
import type { Command } from './commands/types'
|
||||
|
||||
export const logger = createLogger({
|
||||
level: config.logLevel === 'none' ? Number.MAX_SAFE_INTEGER : config.logLevel,
|
||||
})
|
||||
|
||||
import * as commands from './commands'
|
||||
import * as schemas from './database/schemas'
|
||||
|
||||
import type { default as Command, CommandOptionsOptions } from './classes/Command'
|
||||
|
||||
export const api = {
|
||||
client: new APIClient({
|
||||
api: {
|
||||
@@ -81,8 +81,8 @@ export const discord = {
|
||||
},
|
||||
partials: [Partials.Message, Partials.Reaction],
|
||||
}),
|
||||
commands: Object.fromEntries(Object.values<Command>(commands).map(cmd => [cmd.data.name, cmd])) as Record<
|
||||
commands: Object.fromEntries(Object.values(commands).map(cmd => [cmd.name, cmd])) as Record<
|
||||
string,
|
||||
Command
|
||||
Command<boolean, CommandOptionsOptions | undefined, boolean>
|
||||
>,
|
||||
} as const
|
||||
|
||||
Reference in New Issue
Block a user