예제 #1
0
        // ################################

        /// <summary>
        /// Create A Discord Question, That's Have 2 Reactions (Yes, No)
        /// </summary>
        /// <param name="requestInfo">User To Send</param>
        /// <param name="question">Message Text</param>
        /// <returns>True If Yes</returns>
        public async Task <bool> YesNoMessage(AgentRequestInfo requestInfo, string question)
        {
            //                                   YES                         NO
            var emojis = new IEmote[] { new Emoji("\u2705"), new Emoji("\u274C") };

            var message = await requestInfo.Context.Channel.SendMessageAsync($">>> **{question}**");

            await message.AddReactionsAsync(emojis);

            var answer = await WaitReaction(message.Id, emojis);

            // Don't wait remove
            #pragma warning disable 4014
            message.RemoveReactionsAsync(CurrentBot, emojis.Where(r => r.Name != answer.Name).ToArray());
            #pragma warning restore 4014

            return(answer.Name == "\u2705");
        }