示例#1
0
文件: Program.cs 项目: toobeeh/Mobo
 private static async Task onreactionremoved(MessageReactionRemoveEventArgs e)
 {
     // if reaction was made on a vote message and reaction is a valid vote emoji
     if (MoveVotes.Exists(v => v.Message.Equals(e.Message)) &&
         e.Emoji == DiscordEmoji.FromName(Client, ":twisted_rightwards_arrows:"))
     {
         await HandleVoteReaction(e.Message, false);
     }
 }
示例#2
0
文件: Program.cs 项目: toobeeh/Mobo
        public static async Task HandleVoteReaction(DiscordMessage e, bool add = true)
        {
            // get vote message
            var vote = MoveVotes.Find(v => v.Message.Equals(e));

            // try increment votes - false if vote timeout has expired
            if (add ? vote.AddVote() : vote.RemoveVote())
            {
                if (vote.Reactions >= 4)
                {
                    // if move vote count is reached, move the chat
                    await MoveChat(e.Channel.Guild, e.Channel, 10, vote.Channel);

                    MoveVotes.Remove(vote);
                }
            }
            else
            {
                MoveVotes.Remove(vote);
            }
        }