There is a handler for processing messages for the telegram bot. Inside under certain conditions, the Pyrogram method should operate
# 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)
before with app:
everything works, after no. (outputs only 1, 2 no, it means mistake in with app:
. If i use with app:
outside of handler everything works