3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

debug: catch & trace interaction reply errors

This commit is contained in:
Dragory 2022-06-01 18:58:54 +03:00
parent 016330366e
commit 6df67da3cb
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
4 changed files with 27 additions and 15 deletions

View file

@ -205,7 +205,9 @@ export const MutesCmd = mutesCmd({
collector.on("collect", async (interaction: MessageComponentInteraction) => { collector.on("collect", async (interaction: MessageComponentInteraction) => {
if (msg.author.id !== interaction.user.id) { if (msg.author.id !== interaction.user.id) {
interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }); interaction
.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true })
.catch((err) => console.trace(err.message));
} else { } else {
collector.resetTimer(); collector.resetTimer();
await interaction.deferUpdate(); await interaction.deferUpdate();

View file

@ -23,10 +23,12 @@ export const onButtonInteraction = typedGuildEventListener<RoleButtonsPluginType
const buttons = config.buttons[name]; const buttons = config.buttons[name];
const option: TRoleButtonOption | undefined = buttons?.options[optionIndex]; const option: TRoleButtonOption | undefined = buttons?.options[optionIndex];
if (!buttons || !option) { if (!buttons || !option) {
args.interaction.reply({ args.interaction
ephemeral: true, .reply({
content: "Invalid option selected", ephemeral: true,
}); content: "Invalid option selected",
})
.catch((err) => console.trace(err.message));
return; return;
} }
@ -39,10 +41,12 @@ export const onButtonInteraction = typedGuildEventListener<RoleButtonsPluginType
if (member.roles.cache.has(option.role_id)) { if (member.roles.cache.has(option.role_id)) {
rolesToRemove.push(option.role_id); rolesToRemove.push(option.role_id);
args.interaction.reply({ args.interaction
ephemeral: true, .reply({
content: `The role **${roleName}** will be removed shortly!`, ephemeral: true,
}); content: `The role **${roleName}** will be removed shortly!`,
})
.catch((err) => console.trace(err.message));
} else { } else {
rolesToAdd.push(option.role_id); rolesToAdd.push(option.role_id);
@ -54,10 +58,12 @@ export const onButtonInteraction = typedGuildEventListener<RoleButtonsPluginType
} }
} }
args.interaction.reply({ args.interaction
ephemeral: true, .reply({
content: `You will receive the **${roleName}** role shortly!`, ephemeral: true,
}); content: `You will receive the **${roleName}** role shortly!`,
})
.catch((err) => console.trace(err.message));
} }
for (const roleId of rolesToAdd) { for (const roleId of rolesToAdd) {

View file

@ -192,7 +192,9 @@ export async function displaySearch(
collector.on("collect", async (interaction: MessageComponentInteraction) => { collector.on("collect", async (interaction: MessageComponentInteraction) => {
if (msg.author.id !== interaction.user.id) { if (msg.author.id !== interaction.user.id) {
interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }); interaction
.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true })
.catch((err) => console.trace(err.message));
} else { } else {
if (interaction.customId === `previousButton:${idMod}` && currentPage > 1) { if (interaction.customId === `previousButton:${idMod}` && currentPage > 1) {
collector.stop(); collector.stop();

View file

@ -27,7 +27,9 @@ export async function waitForButtonConfirm(
collector.on("collect", (interaction: MessageComponentInteraction) => { collector.on("collect", (interaction: MessageComponentInteraction) => {
if (options?.restrictToId && options.restrictToId !== interaction.user.id) { if (options?.restrictToId && options.restrictToId !== interaction.user.id) {
interaction.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true }); interaction
.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true })
.catch((err) => console.trace(err.message));
} else { } else {
if (interaction.customId.startsWith(`confirmButton:${idMod}:`)) { if (interaction.customId.startsWith(`confirmButton:${idMod}:`)) {
message.delete(); message.delete();