3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-14 21:31:50 +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,
interaction: ContextMenuCommandInteraction,
) {
interaction.deferReply({ ephemeral: true });
await interaction.deferReply({ ephemeral: true });
const executingMember = await pluginData.guild.members.fetch(interaction.user.id);
const userCfg = await pluginData.config.getMatchingConfig({
channelId: interaction.channelId,
@ -34,10 +34,10 @@ export async function cleanAction(
const user = undefined;
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);
} 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) {
pluginData.getPlugin(LogsPlugin).logBotAlert({

View file

@ -15,7 +15,7 @@ export async function muteAction(
duration: string | undefined,
interaction: ContextMenuCommandInteraction,
) {
interaction.deferReply({ ephemeral: true });
await interaction.deferReply({ ephemeral: true });
const executingMember = await pluginData.guild.members.fetch(interaction.user.id);
const userCfg = await pluginData.config.getMatchingConfig({
channelId: interaction.channelId,
@ -34,7 +34,7 @@ export async function muteAction(
const targetMember = await pluginData.guild.members.fetch(interaction.targetId);
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;
}
@ -51,9 +51,9 @@ export async function muteAction(
result.notifyResult.method ?? "dm"
})\nPlease update the new case with the \`update\` command`;
interaction.followUp({ ephemeral: true, content: muteMessage });
await interaction.followUp({ ephemeral: true, content: muteMessage });
} 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) {
pluginData.getPlugin(LogsPlugin).logBotAlert({

View file

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