Search code examples
discorddiscord.net

Discord.NET C# How do I make the bot wait for an input before proceeding with the command


I was wondering how I could do something like this in my commands class:

  public string yuh;
  [Command("test")]
    public async Task test(params string[] args) 
    {
        if (args.Length == 0)
        {
            await ReplyAsync("Tell me something.");
            ***WAIT FOR A USER INPUT***
            yuh = Context.Message.Content;

        }
        await ReplyAsync(yuh);
    }

What do I put in the WAIT FOR A USER INPUT?


Solution

  • You can use Discord.Addons.Interactive. It's a "Addon" for Discord.Net installed with NuGet.

    var response = await NextMessageAsync();
    

    GitHub File Example