【问题标题】:Discord.NET C# How do I make the bot wait for an input before proceeding with the commandDiscord.NET C#如何让机器人在继续执行命令之前等待输入
【发布时间】:2020-11-23 09:44:13
【问题描述】:

我想知道如何在我的命令类中做这样的事情:

  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);
    }

我在 WAIT FOR A USER INPUT 中输入了什么?

【问题讨论】:

标签: discord discord.net


【解决方案1】:

您可以使用Discord.Addons.Interactive。这是使用 NuGet 安装的 Discord.Net 的“插件”。

var response = await NextMessageAsync();

GitHub File Example

【讨论】:

  • 我在 NuGet 包管理器的 NuGet 包列表中找不到 Discord.Addons.Interactive。如何直接安装?
  • nvm 找到了!谢谢!
猜你喜欢
  • 2021-12-03
  • 1970-01-01
  • 2016-06-16
  • 2021-11-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多