Skip to content

Commit

Permalink
Revert "v4.12.4 - Bug fix no event de erro duplicado"
Browse files Browse the repository at this point in the history
  • Loading branch information
alanfilho184 authored Mar 27, 2024
1 parent 81420c2 commit 6392328
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kami",
"version": "4.12.4",
"version": "4.12.3",
"description": "Um BOT para Discord com foco em ajudar em mesas de RPG online, tendo suas principais funções criar fichas e rolar dados.",
"main": "index.js",
"scripts": {
Expand Down
15 changes: 10 additions & 5 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ module.exports = class MenuClient extends Discord.Client {
logging: false,
dialect: "postgres",
}

if (process.env.NODE_ENV == "production") {
conStr["dialectOptions"] = {
ssl: {
Expand All @@ -130,7 +130,7 @@ module.exports = class MenuClient extends Discord.Client {
}
}
}

return conStr
}

Expand Down Expand Up @@ -162,7 +162,9 @@ module.exports = class MenuClient extends Discord.Client {
if (err == "TypeError: Cannot read property 'send' of null") {
process.exit(1)
}

else if (err != "DiscordAPIError: Unknown interaction") {
this.emit("err", err, true)
}
logs.log.error(err, true)

errorStack++
Expand All @@ -177,7 +179,9 @@ module.exports = class MenuClient extends Discord.Client {
if (err == "TypeError: Cannot read property 'send' of null") {
process.exit(1)
}

else if (err != "DiscordAPIError: Unknown interaction") {
this.emit("err", err, true)
}
logs.log.error(err, true)

errorStack++
Expand All @@ -197,6 +201,7 @@ module.exports = class MenuClient extends Discord.Client {
})

})

}

setCache() {
Expand Down Expand Up @@ -259,7 +264,7 @@ module.exports = class MenuClient extends Discord.Client {
}
}

setWebSocket() {
setWebSocket(){
const ws = require("./modules/websocket/server")
new ws(this)
}
Expand Down
23 changes: 3 additions & 20 deletions src/events/discord/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,7 @@ module.exports = {
return int.reply({ embeds: [disableEmbed], ephemeral: true })
}
else {
try {
cmd.run(client, int)
.catch(err => {
client.log.error(err, true)
if (int.deferred) {
if (int.replied) {
return
}
else {
return int.editReply({ content: client.tl({ local: int.lang + "intCreate-onErr" }), ephemeral: true })
}
}
else {
return int.reply({ content: client.tl({ local: int.lang + "intCreate-onErr" }), ephemeral: true })
}
})
}
catch (err) {
client.log.error(err, true)
client.on("err", (err, logged) => {
if (int.deferred) {
if (int.replied) {
return
Expand All @@ -66,8 +48,9 @@ module.exports = {
else {
return int.reply({ content: client.tl({ local: int.lang + "intCreate-onErr" }), ephemeral: true })
}
}
})

cmd.run(client, int)
client.emit("cmd", int, cmd.name)
const args = client.utils.argsString(int)
client.log.info(`Comando: ${cmd.name} executado por ${int.user.tag}(${int.user.id}) ${args ? `- Args: ${args}` : ``}`)
Expand Down

0 comments on commit 6392328

Please sign in to comment.