from telethon import functions, types
client = TelegramClient(fr"./acc/{i.replace(".json", "")}" , data["app_id"], data["app_hash"]}
link = client(functions.users.GetFullUserRequest(user_id))
print(client.get_entity(link.chats[0].id).username)
def excel_db(name, info):
nametable = ''
wb = openpyxl.Workbook()
#wb = openpyxl.load_workbook(nametable)
list1 = wb.active
print(wb.sheetnames)
for i in range(len(info)):
if i == 0:
continue
c1 = list1.cell(row=i, column=1, value=info[i-1][0])
c2 = list1.cell(row=i, column=2, value=info[i-1][1])
wb.save(f"db_{name}.xlsx")
get_chat_member()
import telebot
bot = telebot.TeleBot("TOKEN")
CHAT_ID = -1001...
USER_ID = 700...
result = bot.get_chat_member(CHAT_ID, USER_ID)
print(result)
bot.polling()
{'user': {'id': 700..., 'is_bot': False, 'first_name': '', 'username': None, 'last_name': None, ... }
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400 Description: Bad Request: user not found