'How do I get message as a string varible, Discord.Net
I'm trying to maka Discord bot using Discord.Net. 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)
}
Solution 1:[1]
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 !
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Anu6is |
