コード例 #1
0
        protected override async Task CheckAnswerInternalAsync(ICommandContext answer)
        {
            string userAnswer = Utils.CleanWord(answer.GetArgument <string>("answer"));

            if (!_allValidNames.Any(x => Utils.CleanWord(x) == userAnswer))
            {
                throw new InvalidGameAnswer(""); // We just add a reaction to the message to not spam the text channel
            }
            if (!_current.Answers.Any(x => Utils.CleanWord(x) == userAnswer))
            {
                throw new InvalidGameAnswer("No this is not " + answer + ".");
            }
            await answer.AddReactionAsync(new Emoji("✅"));
        }