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", "@types/ws": "^8.5.10",
"typed-emitter": "^2.1.0" "typed-emitter": "^2.1.0"
} }
} }

View File

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

View File

@@ -9,7 +9,8 @@ withContext(on, 'interactionCreate', async (context, interaction) => {
const command = discord.commands[interaction.commandName] const command = discord.commands[interaction.commandName]
logger.debug(`Command ${interaction.commandName} being invoked by ${interaction.user.tag}`) 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 { try {
logger.debug(`Command ${interaction.commandName} being executed`) logger.debug(`Command ${interaction.commandName} being executed`)

View File

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

View File

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

View File

@@ -10,5 +10,10 @@ if (missingEnvs.length) {
process.exit(1) 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() api.client.connect()
discord.client.login() discord.client.login()