2

有一个处理程序用于处理电报机器人的消息。在某些条件下,Pyrogram 方法应该在内部运行

# coding: utf8
import telebot
from pyrogram import *
import time
bot   = telebot.TeleBot('BOTTOKEN')

@bot.message_handler(content_types=['text'])
def mes_handler(message):
    if message.text == 'Test123':
        app = Client('my_account')
        print(1)
        with app:
            print(2)
            users_data = app.iter_chat_members(groupID)
            print(users_data)

while True:
    try:
        bot.polling(none_stop=True)
    except Exception as e:
        print(e)
        time.sleep(15)

with app:一切正常之前,在没有之后。(仅输出 1、2 否,这意味着错误with app:。如果我with app:在处理程序之外使用一切正常

4

0 回答 0