Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47fc7bd
commit e8b95a2
Showing
10 changed files
with
165 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,4 +108,4 @@ module.exports = class EditButton extends Button { | |
); | ||
} | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { Listener } = require('@eartharoid/dbf'); | ||
|
||
module.exports = class extends Listener { | ||
constructor(client, options) { | ||
super(client, { | ||
...options, | ||
emitter: client.autocomplete, | ||
event: 'error', | ||
}); | ||
} | ||
|
||
async run({ | ||
completer, | ||
error, | ||
interaction, | ||
}) { | ||
this.client.log.error.autocomplete(`"${completer.id}" autocomplete execution error:`, { | ||
error, | ||
interaction, | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const { Listener } = require('@eartharoid/dbf'); | ||
const { | ||
EmbedBuilder, | ||
codeBlock, | ||
} = require('discord.js'); | ||
const { getSUID } = require('../../lib/logging'); | ||
|
||
module.exports = class extends Listener { | ||
constructor(client, options) { | ||
super(client, { | ||
...options, | ||
emitter: client.menus, | ||
event: 'error', | ||
}); | ||
} | ||
|
||
async run({ | ||
menu, | ||
error, | ||
interaction, | ||
}) { | ||
const ref = getSUID(); | ||
this.client.log.error.menus(ref); | ||
this.client.log.error.menus(`"${menu.id}" menu execution error:`, error); | ||
let locale = null; | ||
if (interaction.guild) { | ||
locale = (await this.client.prisma.guild.findUnique({ | ||
select: { locale: true }, | ||
where: { id: interaction.guild.id }, | ||
})).locale; | ||
} | ||
const getMessage = this.client.i18n.getLocale(locale); | ||
const data = { | ||
components: [], | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setColor('Orange') | ||
.setTitle(getMessage('misc.error.title')) | ||
.setDescription(getMessage('misc.error.description')) | ||
.addFields([ | ||
{ | ||
name: getMessage('misc.error.fields.identifier'), | ||
value: codeBlock(' ' + ref + ' '), | ||
}, | ||
]), | ||
], | ||
}; | ||
|
||
interaction.reply(data).catch(() => interaction.editReply(data)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const { Listener } = require('@eartharoid/dbf'); | ||
const { | ||
EmbedBuilder, | ||
codeBlock, | ||
} = require('discord.js'); | ||
const { getSUID } = require('../../lib/logging'); | ||
|
||
module.exports = class extends Listener { | ||
constructor(client, options) { | ||
super(client, { | ||
...options, | ||
emitter: client.modals, | ||
event: 'error', | ||
}); | ||
} | ||
|
||
async run({ | ||
modal, | ||
error, | ||
interaction, | ||
}) { | ||
const ref = getSUID(); | ||
this.client.log.error.modals(ref); | ||
this.client.log.error.modals(`"${modal.id}" modal execution error:`, error); | ||
let locale = null; | ||
if (interaction.guild) { | ||
locale = (await this.client.prisma.guild.findUnique({ | ||
select: { locale: true }, | ||
where: { id: interaction.guild.id }, | ||
})).locale; | ||
} | ||
const getMessage = this.client.i18n.getLocale(locale); | ||
const data = { | ||
components: [], | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setColor('Orange') | ||
.setTitle(getMessage('misc.error.title')) | ||
.setDescription(getMessage('misc.error.description')) | ||
.addFields([ | ||
{ | ||
name: getMessage('misc.error.fields.identifier'), | ||
value: codeBlock(' ' + ref + ' '), | ||
}, | ||
]), | ||
], | ||
}; | ||
|
||
interaction.reply(data).catch(() => interaction.editReply(data)); | ||
} | ||
}; |