fix: other small issues

This commit is contained in:
PalmDevs
2024-07-31 19:33:40 +07:00
parent 620f9339f0
commit bc437a5ec7
6 changed files with 11 additions and 5 deletions

View File

@@ -37,4 +37,4 @@
"@types/ws": "^8.5.10",
"typed-emitter": "^2.1.0"
}
}
}

View File

@@ -43,4 +43,4 @@
"discord-api-types": "^0.37.92",
"drizzle-kit": "^0.22.8"
}
}
}

View File

@@ -9,7 +9,8 @@ withContext(on, 'interactionCreate', async (context, interaction) => {
const command = discord.commands[interaction.commandName]
logger.debug(`Command ${interaction.commandName} being invoked by ${interaction.user.tag}`)
if (!command) return void logger.error(`Command ${interaction.commandName} not implemented but registered!!!`)
if (!command)
return void logger.error(`Interaction command ${interaction.commandName} not implemented but registered!!!`)
try {
logger.debug(`Command ${interaction.commandName} being executed`)

View File

@@ -19,7 +19,7 @@ withContext(on, 'messageCreate', async (context, msg) => {
const command = discord.commands[commandName]
logger.debug(`Command ${commandName} being invoked by ${msg.author.id}`)
if (!command) return void logger.error(`Command ${commandName} not implemented`)
if (!command) return void logger.debug(`Message command ${commandName} not implemented`)
const argsRegex: RegExp = /[^\s"]+|"([^"]*)"/g
const args: CommandArguments = []

View File

@@ -33,7 +33,7 @@ withContext(on, 'messageCreate', async (context, msg) => {
if (response) {
logger.debug('Response found')
const toReply = replyToReplied ? await msg.fetchReference() : msg
const toReply = replyToReplied ? (msg.reference?.messageId ? await msg.fetchReference() : msg) : msg
const reply = await toReply.reply({
...response,
embeds: response.embeds?.map(it => createMessageScanResponseEmbed(it, label ? 'nlp' : 'match')),

View File

@@ -10,5 +10,10 @@ if (missingEnvs.length) {
process.exit(1)
}
// Handle uncaught exceptions
process.on('uncaughtException', error => console.error('Uncaught exception:', error))
process.on('unhandledRejection', reason => console.error('Unhandled rejection:', reason))
api.client.connect()
discord.client.login()