简体   繁体   English

如何将消息作为字符串变量获取,Discord.Net

[英]How do I get message as a string varible, Discord.Net

I'm trying to maka Discord bot using Discord.Net.我正在尝试使用 Discord.Net 制造 Discord 机器人。 I wanna take message as a string variable and use it.我想将消息作为字符串变量并使用它。

    [Command("GetMesage")]
    public async Task GetMssg()
    {
        await ReplyAsync("Write your message now ");
        //Message from user = string message
        await ReplyAsync(message)
    }

Instead of executing the command and then asking the user to input a message, they can provide the message at the same time the command is invoked.他们可以在调用命令的同时提供消息,而不是执行命令然后要求用户输入消息。

    [Command("GetMesage")]
    public async Task GetMssg([Remainder] string message)
    {
        await ReplyAsync(message)
    }

This is invoked like !GetMessage Some Text here assuming a prefix of !这被调用为!GetMessage Some Text here假设前缀为!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM