0

Trying to do some stuff with telebot + telethon.

-------------------- Code --------------------


      FILE: All.py
      if bot.get_chat_member(message.chat.id, message.from_user.id).status != 'member':
         f = open("assets/database/" + str(message.chat.id) + '.txt', 'w+')
         invite = bot.export_chat_invite_link(message.chat.id)
         bot.get_chat(message.chat.id)
         f.close()
         chat_id = str(message.chat.id)
         f = open("assets/transfer/" + str(message.chat.id) + '.txt', 'w+')
         f.write(str(invite) + " " + str(message.from_user.id))
         f.close()
         a = bot.send_message(message.chat.id, message.chat.id)
         mess_id = a.message_id
         bot.delete_message(message.chat.id, mess_id)
         GetMember = bot.get_chat_member(message.chat.id, message.from_user.id)
         f = open("assets/transfer/chat_id.txt", 'w+')
         f.write(str(message.chat.id))
         f.close()
         import Test.py
         bot.send_message(message.chat.id, 'Запись проведена успешно. Спасибо!')

           FILE Test.py

client = TelegramClient('Bot-Helper', api_id, api_hash).start(bot_token=bot_token)

ch = open('assets/transfer/chat_id.txt', 'r+')
chat_id = ch.readline()
f = open('assets/transfer/' + str(chat_id) + '.txt', 'r+')
fn = open('assets/database/' + str(chat_id) + '.txt', 'w+')
stroka = f.readline().split()
f.close()
parti = client.get_participants(str(stroka[0]))
for x in parti:
   if x.bot == False:
      fn.write(str(x.id) + " ")
   else:
      pass
fn.close()

Error screenshot:

Click me!

Please, help me. I really need it.

  • Hi, can you please provide more details about what is the desired output for what you're trying to do? Also, if possible, include the error message inside the thread, so that future members will find it – Ruslan Jul 25 '20 at 20:36
  • See [How to combine python asyncio with threads?](https://stackoverflow.com/q/28492103/4759433). Beware however that you generally do **not** need to use threads at all when using `asyncio` (and instead use tasks). – Lonami Jul 26 '20 at 12:40

0 Answers0