You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
754 B
20 lines
754 B
2 years ago
|
import { commands } from './commands'
|
||
|
import { SlashCreator, CFWorkerServer } from './shim'
|
||
|
|
||
|
export const creator = new SlashCreator({
|
||
|
applicationID: DISCORD_APP_ID,
|
||
|
publicKey: DISCORD_PUBLIC_KEY,
|
||
|
token: DISCORD_BOT_TOKEN,
|
||
|
})
|
||
|
|
||
|
creator.withServer(new CFWorkerServer()).registerCommands(commands)
|
||
|
|
||
|
creator.on('warn', (message) => console.warn(message))
|
||
|
creator.on('error', (error) => console.error(error.stack || error.toString()))
|
||
|
creator.on('commandRun', (command, _, ctx) =>
|
||
|
console.info(`${ctx.user.username}#${ctx.user.discriminator} (${ctx.user.id}) ran command ${command.commandName}`),
|
||
|
)
|
||
|
creator.on('commandError', (command, error) =>
|
||
|
console.error(`Command ${command.commandName} errored:`, error.stack || error.toString()),
|
||
|
)
|