transmission-telegram-remote.py 文件源码

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

项目:transmission-telegram-remote 作者: gbrlmza 项目源码 文件源码
def start(self):
        try:
            self.torrent_client = transmissionrpc.Client(
                self.config.get('transmission', 'rpc_host'),
                port=self.config.get('transmission', 'rpc_port'),
                user=self.config['transmission']['rpc_user'],
                password=self.config['transmission']['rpc_password'])
        except transmissionrpc.error.TransmissionError:
            print("ERROR: Couldn't connect to Transmission. Check rpc configuration.")
            sys.exit()

        try:
            self.bot = telepot.Bot(self.config.get('telegram', 'bot_token'))
            self.bot.setWebhook('') # Remove existent webhook
            self.bot.message_loop(
                self.handle_mesasge,
                relax=self.config.getint('telegram', 'polling_interval'))
        except telepot.exception.TelegramError:
            print("ERROR: Couldn't start Telegram bot. Check telegram bot configuration.")
            sys.exit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号