mirror of
https://github.com/RPCS3/discord-bot.git
synced 2025-04-01 11:51:45 +00:00
prevent command spam when we have interactive prompt and the user uses another command instead
This commit is contained in:
parent
754c25d4de
commit
0138d54ed0
@ -47,7 +47,7 @@ namespace CompatBot.Commands
|
||||
var prompt = await ctx.RespondAsync($"{ctx.Message.Author.Mention} what game do you want to check?").ConfigureAwait(false);
|
||||
var interact = ctx.Client.GetInteractivity();
|
||||
var response = await interact.WaitForMessageAsync(m => m.Author == ctx.Message.Author && m.Channel == ctx.Channel).ConfigureAwait(false);
|
||||
if (string.IsNullOrEmpty(response?.Message?.Content))
|
||||
if (string.IsNullOrEmpty(response?.Message?.Content) || response.Message.Content.StartsWith(Config.CommandPrefix))
|
||||
{
|
||||
await prompt.ModifyAsync("You should specify what you're looking for").ConfigureAwait(false);
|
||||
return;
|
||||
|
@ -34,7 +34,7 @@ namespace CompatBot.Commands
|
||||
var sourceTerm = term;
|
||||
if (string.IsNullOrEmpty(term))
|
||||
{
|
||||
var botMsg = await ctx.RespondAsync("Please specify term to explain").ConfigureAwait(false);
|
||||
var botMsg = await ctx.RespondAsync("Please tell what term to explain:").ConfigureAwait(false);
|
||||
var lastBotMessages = await ctx.Channel.GetMessagesBeforeAsync(ctx.Message.Id, 10).ConfigureAwait(false);
|
||||
var showList = true;
|
||||
foreach (var pastMsg in lastBotMessages)
|
||||
@ -50,7 +50,7 @@ namespace CompatBot.Commands
|
||||
var interact = ctx.Client.GetInteractivity();
|
||||
var newMessage = await interact.WaitForMessageAsync(m => m.Author == ctx.User && m.Channel == ctx.Channel && !string.IsNullOrEmpty(m.Content)).ConfigureAwait(false);
|
||||
await botMsg.DeleteAsync().ConfigureAwait(false);
|
||||
if (string.IsNullOrEmpty(newMessage?.Message?.Content))
|
||||
if (string.IsNullOrEmpty(newMessage?.Message?.Content) || newMessage.Message.Content.StartsWith(Config.CommandPrefix))
|
||||
{
|
||||
await ctx.ReactWithAsync(Config.Reactions.Failure).ConfigureAwait(false);
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user