telegram.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:pytgbridge 作者: sfan5 项目源码 文件源码
def __init__(self, config):
        if config["token"] == "":
            logging.error("No telegram token specified, exiting")
            exit(1)
        self.token = config["token"]
        self.bot = telebot.TeleBot(self.token, threaded=False)
        self.event_handlers = {}
        self.own_user = None

        self._telebot_event_handler(self.cmd_start, commands=["start"])
        self._telebot_event_handler(self.cmd_help, commands=["help"])
        # FIXME: not a portable way of registering commands
        self._telebot_event_handler(self.cmd_me, commands=["me"])
        for k, v in mapped_content_type.items():
            if v == "": continue
            self._telebot_event_handler_passthrough(v, content_types=[k])
        for k in content_types_media:
            self._telebot_event_handler(self.on_media, content_types=[k])
        self._telebot_event_handler(self.on_content_type_none, content_types=[None])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号