简体   繁体   中英

C# Discord.net 1.0.1 - How to retrieve a users message

I am having a problem trying to receive/retrieve a message from a user. I am trying to compare the given message to a stored value. Here is my code:

                Random rand = new Random();
            int randomWord = rand.Next(rWords.Length);
            string text = Convert.ToString(rWords[randomWord]);
            var guess = await Context.Channel. //How do i retrieve a message from a user?
            if (gChar.Length != 1)
            {
                var message2 = await Context.Channel.SendMessageAsync("You can only guess 1 letter a time.");
                DelayDeleteMessage(Context.Message, 10);
                DelayDeleteMessage(message2, 10);
                return;
            } else
            {
                if (guess != text)
                {

                }
            }

the var guess is supposed to be the users input.
The string 'text' is connected to an array with a couple of words in it so it can compare the 2 values.

var guess = Context.Message.Content;

^这将从用户那里检索消息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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