Skip to content

Commit

Permalink
Lockdown: Only try to FollowUpAsync when slash cmd is used
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Jan 2, 2025
1 parent 961e569 commit 1ae753c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Commands/LockdownCmds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ await thread.ModifyAsync(a =>
try
{
await LockdownHelpers.LockChannelAsync(user: ctx.User, channel: currentChannel, duration: lockDuration, reason: reason, lockThreads: lockThreads);
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent("Channel locked successfully.").AsEphemeral(true));
if (ctx is SlashCommandContext)
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent("Channel locked successfully.").AsEphemeral(true));
}
catch (ArgumentException)
{
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent("Failed to lock this channel!").AsEphemeral(true));
if (ctx is SlashCommandContext)
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent("Failed to lock this channel!").AsEphemeral(true));
}
}

Expand Down Expand Up @@ -175,11 +177,13 @@ public class UnlockCmds
try
{
await LockdownHelpers.UnlockChannel(currentChannel, ctx.Member);
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent("Channel locked successfully.").AsEphemeral(true));
if (ctx is SlashCommandContext)
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent("Channel locked successfully.").AsEphemeral(true));
}
catch (ArgumentException)
{
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent("Failed to lock this channel!").AsEphemeral(true));
if (ctx is SlashCommandContext)
await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent("Failed to lock this channel!").AsEphemeral(true));
}
}

Expand Down

0 comments on commit 1ae753c

Please sign in to comment.