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

fix: occasional crash in context menus

Co-authored-by: metal <metal@i0.tf>
This commit is contained in:
Dragory 2023-04-01 21:40:27 +03:00
parent 3064a05b4d
commit dd2eebd4a5
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
3 changed files with 8 additions and 8 deletions

View file

@ -10,7 +10,7 @@ export async function cleanAction(
amount: number, amount: number,
interaction: ContextMenuCommandInteraction, interaction: ContextMenuCommandInteraction,
) { ) {
interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const executingMember = await pluginData.guild.members.fetch(interaction.user.id); const executingMember = await pluginData.guild.members.fetch(interaction.user.id);
const userCfg = await pluginData.config.getMatchingConfig({ const userCfg = await pluginData.config.getMatchingConfig({
channelId: interaction.channelId, channelId: interaction.channelId,
@ -34,10 +34,10 @@ export async function cleanAction(
const user = undefined; const user = undefined;
try { try {
interaction.followUp(`Cleaning... Amount: ${amount}, User Only: ${targetUserOnly}, Pins: ${deletePins}`); await interaction.followUp(`Cleaning... Amount: ${amount}, User Only: ${targetUserOnly}, Pins: ${deletePins}`);
utility.clean({ count: amount, user, channel: targetMessage.channel.id, "delete-pins": deletePins }, targetMessage); utility.clean({ count: amount, user, channel: targetMessage.channel.id, "delete-pins": deletePins }, targetMessage);
} catch (e) { } catch (e) {
interaction.followUp({ ephemeral: true, content: "Plugin error, please check your BOT_ALERTs" }); await interaction.followUp({ ephemeral: true, content: "Plugin error, please check your BOT_ALERTs" });
if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) { if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) {
pluginData.getPlugin(LogsPlugin).logBotAlert({ pluginData.getPlugin(LogsPlugin).logBotAlert({

View file

@ -15,7 +15,7 @@ export async function muteAction(
duration: string | undefined, duration: string | undefined,
interaction: ContextMenuCommandInteraction, interaction: ContextMenuCommandInteraction,
) { ) {
interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const executingMember = await pluginData.guild.members.fetch(interaction.user.id); const executingMember = await pluginData.guild.members.fetch(interaction.user.id);
const userCfg = await pluginData.config.getMatchingConfig({ const userCfg = await pluginData.config.getMatchingConfig({
channelId: interaction.channelId, channelId: interaction.channelId,
@ -34,7 +34,7 @@ export async function muteAction(
const targetMember = await pluginData.guild.members.fetch(interaction.targetId); const targetMember = await pluginData.guild.members.fetch(interaction.targetId);
if (!canActOn(pluginData, executingMember, targetMember)) { if (!canActOn(pluginData, executingMember, targetMember)) {
interaction.followUp({ ephemeral: true, content: "Cannot mute: insufficient permissions" }); await interaction.followUp({ ephemeral: true, content: "Cannot mute: insufficient permissions" });
return; return;
} }
@ -51,9 +51,9 @@ export async function muteAction(
result.notifyResult.method ?? "dm" result.notifyResult.method ?? "dm"
})\nPlease update the new case with the \`update\` command`; })\nPlease update the new case with the \`update\` command`;
interaction.followUp({ ephemeral: true, content: muteMessage }); await interaction.followUp({ ephemeral: true, content: muteMessage });
} catch (e) { } catch (e) {
interaction.followUp({ ephemeral: true, content: "Plugin error, please check your BOT_ALERTs" }); await interaction.followUp({ ephemeral: true, content: "Plugin error, please check your BOT_ALERTs" });
if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) { if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) {
pluginData.getPlugin(LogsPlugin).logBotAlert({ pluginData.getPlugin(LogsPlugin).logBotAlert({

View file

@ -7,7 +7,7 @@ export async function userInfoAction(
pluginData: GuildPluginData<ContextMenuPluginType>, pluginData: GuildPluginData<ContextMenuPluginType>,
interaction: ContextMenuCommandInteraction, interaction: ContextMenuCommandInteraction,
) { ) {
interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const executingMember = await pluginData.guild.members.fetch(interaction.user.id); const executingMember = await pluginData.guild.members.fetch(interaction.user.id);
const userCfg = await pluginData.config.getMatchingConfig({ const userCfg = await pluginData.config.getMatchingConfig({
channelId: interaction.channelId, channelId: interaction.channelId,