我的机器人必须删除一个我回复的人但是没有工作

时间:2018-06-04 09:31:18

标签: c# telegram telegram-bot

  1. 我的机器人必须删除我重播的人,但dosnt工作,我认为我的代码是错误的
    1. 我特意使用Telegram.bot Api

      public static Telegram.Bot.TelegramBotClient bot = new Telegram.Bot.TelegramBotClient(token);
      
      1. 此方法必须删除我在其上回复的人,但它不起作用

        public static async Task RemoveMembersFromGp() {
            while (true) {
                int whilecounr = 0;
                int offset = 0;
        
                Telegram.Bot.Types.Update[] updates = bot.GetUpdatesAsync(offset).Result;
        
                Console.WriteLine("While Count IS {0}", whilecounr);
                Console.WriteLine("Update Count Is : {0}", updates.Count());
                Console.WriteLine("*******************************************************");
        
                whilecounr += 1;
        
                foreach (var update in updates) {
                    offset = update.Id + 1;
        
                    Console.WriteLine("Replay Message is :{0}\n Replay Mesage User name {1}", update.Message.ReplyToMessage.Text, update.Message.ReplyToMessage.From.Username);
        
                    if (update.Message.ReplyToMessage !=null && update.Message.ReplyToMessage.Text == "/ban") {
                        var chat_id = update.Message.ReplyToMessage.Chat.Id;
                        var user_id = update.Message.ReplyToMessage.From.Id;
        
                        await bot.KickChatMemberAsync(chat_id, user_id);
                    }
                    continue;
                }
            }
        }
        

0 个答案:

没有答案