示例#1
0
 public static AntiSpamCommand AvoidNukeCommand(Bot bot)
 {
     return new AntiSpamCommand("", "", "", bot, (message) =>
     {
         return (message.system &&
                (
                    message.text.ToUpper().Contains("REMOVED") ||
                    message.text.ToUpper().Contains("REMOVEU")
                ));
     },
     (message) =>
     {
     }, SpamCounter.SpamType.SPAM,
     (message) =>
     {
         bot.KickUser(ConfigurationManager.AppSettings["GROUPME_TOKEN"], message.sender_id);
     });
 }
示例#2
0
 public static void UpdateMembersByGroupAndKickIfBanned(string groupMeToken, string groupID, Bot bot)
 {
     var dbMembers = GetMembers();
     var chat = Model.GroupMe.Chat.GetGroup(groupMeToken, groupID);
     if (chat != null)
     {
         foreach (var member in chat.Members)
         {
             var dbMember = dbMembers.FirstOrDefault(m => m.GroupMeID == member.UserID);
             if (dbMember == null)
             {
                 UpdateMember(new Model.Member
                 {
                     GroupMeID = member.UserID,
                     Name = member.Name,
                     VillageCode = "",
                     Banned = false
                 });
             }
             else if (dbMember.Banned)
             {
                 bot.KickUser(groupMeToken, member.UserID);
                 bot.SendMessage("GTFO!");
             }
         }
     }
 }
示例#3
0
 public static Command KickCommand(Bot bot)
 {
     return new Command("!kick {tag}", "Kick someone from the chat", "!kick @Cha", CommandType.ModsOnly, bot,
                        (message) =>
                        {
                            var isKickCommand = (message.text.ToUpper().StartsWith("!KICK "));
                            if (!isKickCommand)
                            {
                                //Return earlier
                                return false;
                            }
                            var isAMod = Mods.AllMods.Contains(message.user_id);
                            var containsAttachment = message.attachments?.Length == 1;
                            var isAMention = message.attachments[0]?.Type == "mentions";
                            var containsOnlyOneMention = message.attachments[0]?.User_ids?.Length == 1;
                            return isAMod && containsAttachment && isAMention && containsOnlyOneMention;
                        },
                        (message) =>
                        {
                            var mention = message.attachments[0];
                            var userID = mention.User_ids[0];
                            if (Mods.AllMods.Contains(userID))
                            {
                                bot.SendMessage("I won't turn against my Master.");
                            }
                            else
                            {
                                if (bot.KickUser(ConfigurationManager.AppSettings["GROUPME_TOKEN"], userID))
                                {
                                    bot.SendMessage("rekt");
                                }
                                else
                                {
                                    bot.SendMessage("Shit! I can't...");
                                }
                            }
                        });
 }