当他/她加入我的频道后,我如何快速将其踢出我的频道?

时间:2019-07-23 13:01:53

标签: python python-3.x python-2.7 python-telegram-bot

它不起作用 原因是使用MessageHandler时,新成员不是管理员时无法将消息发送到我的频道...而我希望当他快速从我的频道加入我的频道 那么我应该在脚本中使用哪种处理程序?无论如何,在没有处理程序的情况下是否可以在python-telegram-bot(def start(bot,update))中回调函数?

from telegram.ext import Updater,CommandHandler,MessageHandler,Filters,Handler
import logging

logging.basicConfig(level=logging.INFO,format= " %(asctime)s - %(name)s - %(levelname)s - %(message)s ")
logger = logging.getLogger()

token = Updater('TOKEN')

def kicker(bot,update):
    logger.info("User {} get log".format(update.effective_user['id']))
    if update.message.chat_id != 012345678:
        bot.kick_chat_member(chat_id='@Channel_UserName',user_id=update.message.chat_id)


token.dispatcher.add_handler(MessageHandler(Filters.status_update,kicker))

token.start_polling()
token.idle()

0 个答案:

没有答案