telethon

how to add a userbot to a group by link? python telegram api

how to add a userbot to a group by link? python telegram api Question: I get a link with which I need to add the bot to a group (private or public) I did not find anything that could help me my code: link = ‘https://t.me/+r….’ client = TelegramClient(session=’joiner’, api_id=api_id, api_hash=api_hash) #login process result = …

Total answers: 1

Telethon find .session file phone number

Telethon find .session file phone number Question: I have already authorized .session file I forgot his number, tried adding other account to contact, tried changing privacy so I can see from other accs, all with no success.. any suggestions ? Asked By: Bali Cali || Source Answers: Log in to the Telethon .session file normally …

Total answers: 1

How to change single target entity into list using Telethon module in Python

How to change single target entity into list using Telethon module in Python Question: I’m trying to write a script that can send a message to Telegram groups. I can only manage to send to one group at the moment, and when I try to add a list, it doesn’t work. Here is the code …

Total answers: 1

Python LonamiWebs/Telethon get group name of received message

Python LonamiWebs/Telethon get group name of received message Question: Code: from telethon import TelegramClient, events, sync from telethon.tl.types import PeerChat, PeerChannel api_id = 123 api_hash = ‘123’ client = TelegramClient(‘anon’, api_id, api_hash) @client.on(events.NewMessage()) async def my_event_handler(event): if(event.chat.title == ‘BotTest’): print(event.raw_text) client.start() client.run_until_disconnected() Problem: So this code works if group(BotTest) has me/bot(one user) "event.chat.title"(event.chat) exist but …

Total answers: 1

AttributeError in pytest with asyncio after include code in fixtures

AttributeError in pytest with asyncio after include code in fixtures Question: I need to test my telegram bot. To do this I need to create client user to ask my bot. I found telethon library which can do it. First I wrote a code example to ensure that authorisation and connection works and send test …

Total answers: 3

Telegram accounts get banned when using Telethon

Telegram accounts get banned when using Telethon Question: After the start of the bans of accounts connected to my project, I changed the system for receiving new messages in the telegram account. Previously, I implemented it through a handler, now it is possible to connect several accounts, performing actions with unread messages on each one …

Total answers: 2

Telethon receive location from user

Telethon receive location from user Question: What is a proper way to listen to "send location" messages from the user? My solution is to filter out messages by type of their media (process_location): @bot.on(events.NewMessage(pattern=commands(‘/start’))) async def send_welcome(event: events.NewMessage.Event): await event.respond("Hello, I’m your helper bot!", buttons=[ Button.request_location(‘Send location to detect timezone’, resize=True), ]) @bot.on(events.NewMessage(func=lambda e: isinstance(e.media, …

Total answers: 1

Telethon Cannot sign into accounts with two step verfication

Telethon Cannot sign into accounts with two step verfication Question: I’m trying to log into telegram using telethon with a number with two-step verification. I use this code, client = TelegramClient(f’sessions/1′, API_ID, API_HASH) client.connect() phone = input(‘phone ; ‘) y = client.send_code_request(phone) x = client.sign_in(phone=phone, password=input(‘password : ‘), code=input(‘code :’)) But It still says that …

Total answers: 3

How to send stickers using the id (string) in telethon

How to send stickers using the id (string) in telethon Question: Is there any method to send stickers using the id attribute of event.file? The documentation points out to send it using the id and the access_hash of a particular sticker set and then finally using index with sticker_set to send the sticker. Since there’s …

Total answers: 2

Telethon: check if client instance is logged in

Telethon: check if client instance is logged in Question: I am trying to log the user into the account using the telegram bot API, and I can’t find a way to check if the client instance has access to an account… this is my instance: client = TelegramClient(client_name, API_ID, API_HASH) by using client.start() it detects …

Total answers: 1