Exemple #1
0
        void BotOnMessageReceived(object sender, MessageEventArgs args)
        {
            var msg = args.Message;

            if (msg == null || msg.Type != MessageType.Text)
            {
                return;
            }

            string commandResponse = null;

            try { commandResponse = Router.Execute(sender, args); }
            catch { }

            if (commandResponse != null)
            {
                Client.SendTextMessageAsync(
                    args.Message.Chat.Id,
                    commandResponse,
                    replyToMessageId: args.Message.MessageId);
            }
            else
            {
                var unbleepResponse = Unbleeper.UnbleepSwears(msg.Text);
                if (unbleepResponse != null)
                {
                    Client.SendTextMessageAsync(
                        args.Message.Chat.Id,
                        unbleepResponse,
                        replyToMessageId: args.Message.MessageId);
                }
            }
        }
Exemple #2
0
 public AntiAntiSwearingBot(Config cfg, SearchDictionary dict)
 {
     Config    = cfg;
     Dict      = dict;
     Unbleeper = new Unbleeper(dict, cfg.Unbleeper);
 }