Questions tagged [telethon]
Telethon is a Python 3 Telegram client library. It uses the normal Telegram API instead of the Bot API, which means it can perform all actions a regular user can perform. Use this tag when asking questions about using the Telethon library.
909
questions
0
votes
0
answers
5
views
Telegram Global Search using the raw API function via Telethon
I am trying to use the SearchGlobalRequest API method for global, full-text search on Telegram, but I am not sure what to use for some of the arguments, especially the offset_peer parameter. When I do ...
-2
votes
0
answers
18
views
How to send unforward able message via telegram bot [closed]
today i was trying to download a movie from a telegram bot.
The bot sended me the message with media, i tryed to forward it to my SAVED MESSAGES, But it didn't let me. Then i undrestood that im not ...
0
votes
0
answers
9
views
How to read messages from my Private Telegram channel?
I am trying to read messages from my private telegram channel. I used the following code. I am facing a problem reading the message while it is in private but if I change the channel to the public ...
-1
votes
0
answers
20
views
check if username is a group telethon ( telegram python )
hello m looking for a solution to print if a telegram username is a group or not
example :
username = "@username"
if the type of the username is a group return True else return False
0
votes
0
answers
61
views
TypeError: Object of type coroutine is not JSON serializable
I have recently had a problem with the date conversion function.
The code itself works with the Telegram Core API and should receive messages from the channels I need. The function itself seems to ...
0
votes
0
answers
21
views
Function not executing in telethon
If I start the client at the beginning of the script
api_id = 123254534
api_hash = '124324235543'
client = TelegramClient('parslon', api_id, api_hash)
client.start()
***
def three_step(...
0
votes
0
answers
13
views
How to authorize multiple Telethon accounts?
Good day. The question is:
Conventionally, there are txt files, one contains api_id, the other api_hash.
Whether it is possible to register somehow that the data of 1 line undertook at once. In case ...
0
votes
0
answers
14
views
How Can I download media by Telethon Full API
I am trying to download media using the following code. He writes me "File saved to None". There is definitely media in the message.
from telethon import TelegramClient
from telethon.tl....
0
votes
1
answer
15
views
telethon forward messages without a specific word
I am using a telegram bot that forwards messages from a certain channel to any other channel I am on, but I want it to forward these messages without a word, for example the message ends with "...
0
votes
1
answer
19
views
Telethon get_dialogs function is taking forever
I'm trying to list all my account channels that i joined via Telethon. However, the await client.get_dialogs() function is taking forever with no response back!
I did even try the followign code as an ...
0
votes
0
answers
19
views
telethon GetParticipantsRequest: why returning not all members
telethon GetParticipantsRequest: why returning not all members ?
For example, my groups has 3377 members, but GetParticipantsRequest return 3356 members.
while True:
participants = await client(...
0
votes
1
answer
13
views
How do you reply to a message from "Replies" chat (Telethon)?
Problem
My "userbot" leaves comments on new posts from channels
Some users reply to my comments, those replies appear in my "Replies" dialog
I want to reply back to those replies, ...
0
votes
1
answer
19
views
python skip that process when i get an error
telethon.errors.rpcerrorlist.UserAlreadyParticipantError: The authenticated user is already a participant of the chat (caused by ImportChatInviteRequest)
my only request is for it to ignore and ...
0
votes
0
answers
20
views
How to find username from id in telethon
I wanted to know that can I find the username of a public telegram channel from it's public id in telethon?
I tried the get_entity method but it is only working for telegram group not channel.
So, how ...
0
votes
0
answers
20
views
Sending file to private telegram group via telethon
I'm trying to send a file to a private group in which my bot is already an admin member of.
from telethon import TelegramClient
api_id = '1234567'
api_hash = 'myhash'
bot_token ...
0
votes
0
answers
21
views
How to join a telegram channel with only channel id in telethon?
Hy, I have a simple question, how can I join a new telegram channel with its public ID only in telethon via python?
0
votes
1
answer
42
views
Extract channel members from an unknown Telegram public / private channel
I need a solution, to extract channel members from an unknown Telegram public / private channel. I am not the admin of that channel, But I need those all members list.
0
votes
0
answers
21
views
How can I get through telethon authentication problem?
I have some python code interacting with Telegram through Telethon library. And I have this authentication code:
config = configparser.ConfigParser()
config.read("config.ini")
api_id = ...
0
votes
0
answers
60
views
AttributeError: partially initialized module 'logging' has no attribute 'getLogger' (most likely due to a circular import)
I wrote imports as usual, but it is wrong. I searched and did not find a mistake like mine, please help. The file name is main.py .
Traceback (most recent call last):
File "/app/main.py", ...
1
vote
0
answers
34
views
@client.on(events.NewMessage) no longer captures all events
I'm new here, so forgive me if I don't meet certain parameters for questions.
I have a problem: until a few months ago "@client.on(events.NewMessage)" used to capture all messages coming to ...
1
vote
0
answers
33
views
How to get more than 1000 Kicked Users with Telethon
I had a Telegram group with 3000 members. I lost 2500 members. I want to get the username of all them. I tried with this code, but the method just fetch 1000 items and no more. How could I fetch the ...
0
votes
0
answers
30
views
MessageMediaUnsupported() instead of MessageMediaPoll() type when using Telethon
When I receive a message, my client waits until he receives a message that has media type = MessageMediaPoll(), it worked, but the bot has been updated and now when I receive a message with a poll, ...
0
votes
0
answers
19
views
Having trouble running multiple functions in Asyncio
I'm a novice programmer looking to build a script that reads a list of leads from Google Sheets and then messages them on telegram. I want to separate out the first and second message by three days ...
0
votes
0
answers
20
views
In the inline button attached to the message there is a link to a private channel
In the inline button attached to the message there is a link to a private channel. How can I get this link using the library Telethon?
0
votes
0
answers
21
views
Telethon client.disconnect() doesn't work
Once I execute the client from telethon API
client = TelegramClient('Sergi', api_id, api_hash)
client.connect()
I get the output: <coroutine object TelegramBaseClient.connect at 0x7f90571d74d0&...
0
votes
1
answer
26
views
Is telethon blocked in the US?
I run the simple example from the official guide on a US server and got the error: "ConnectionError: Connection to Telegram failed 5 time(s)". I tried a US laptop, the same error.
I then ...
0
votes
0
answers
28
views
How to let the TelegramBot forward the channel's message to the specified group?
The following code implements the forwarding of album to the specified group.
The trigger in the comments section implements forwarding all messages to the specified group,
but the "grouped_id&...
0
votes
1
answer
56
views
how to join multiple telegram group with telethon
I want to join multiple groups with telethon python but I can't
I can only able to join one group at a time anyone knows how to join multiple groups at the same time
with TelegramClient(name, api_id, ...
0
votes
1
answer
75
views
I'm using Python and Telethon as a Telegram client to get new messages, but need to identify a reply and which message it replying to
I have a working Python script with Telethon and it logs in with my account, connects to the correct channel and gets new messages just fine. It also can identify if it is a new message vs a reply to ...
0
votes
0
answers
29
views
Python Telethon (Telegram) keeps erroring out with "too many requests"
I am lookign for some advice on the Telethon python library which gave me some pain lately. This is could be a commercial opportunity, so if you are vary experienced particularly in Telethon, please ...
0
votes
2
answers
49
views
Telethon, TelegramClient.connect how do I set authentication code programmatically
I am using telethon to automate some tasks on Telegram.
I am trying to create an API where third party users can provide phone number and enter code through an api. I have got the phone number part ...
0
votes
1
answer
208
views
ChannelParticipants object is not subscriptable
Have "ChannelParticipants" object is not subscriptable error in telethon.
I am trying to scrape members to CSV file from telegram group. Please help! Here is my code
for chat in chats:
...
0
votes
0
answers
43
views
Why users are not added to the supergroup even though there are no errors?
I have this code:
def get_proxies():
proxy = {
'proxy_type': 'socks5',
'addr': '127.0.0.1',
'port': 9050,
'username': 'user',
'password': str(random.randint(10000, 2147483647))...
0
votes
1
answer
27
views
channel message statistics with get_stats
I'am trying to get message statistics using telethon get_stats.
channel = '@test'
async with client:
stats = await client.get_stats(entity=channel,message=92)
print(stats.stringify())
But I ...
0
votes
0
answers
21
views
How to send new message based on original message's media in Telethon?
I want to modify message (add some text, hastags, maybe new media).
Can I do this without downloading media to disk, creating new message, and uploading media to telegram one more time?
I understand, ...
0
votes
0
answers
34
views
How to send dice/slotmachine emoji on telegram using telethon?
I'm working on a project and my client wants to send that dice/slotmachine emoji (animated one) via API.
I'm currently using telethon python but cannot figure how to send it. When I try sending, it ...
2
votes
1
answer
36
views
How to find out session name of telegram app?
I have created a telegram app via https://my.telegram.org. After I did that I got data about api_id and api_hash but I can't find session name. Where can I find it?
When I use telethon function ...
0
votes
0
answers
33
views
Make telethon raise exception on MTProto errors
I have a basic client logic, which listens on new messages, but sometimes Telegram API sends me 429 error, which is Too Many Requests, and after this Telethon client just fails to do anything else, ...
0
votes
0
answers
70
views
Telethon: FloodWaitError for Sending Message to the Bots
I have a periodic script to send a message to the bots every hour using Telethon to check its responsiveness. I have about 100 bots to be checked. Each bot will need to respond in less than 5 seconds ...
-2
votes
0
answers
30
views
any command to "terminate all other sessions" in telegram with python
I need a script that terminates all other sessions in python. is there any command to "terminate all other sessions" in telethon with python?
1
vote
0
answers
61
views
error with InviteToChannelRequest (telethon)
I'm trying to invite people to my channel using telethon (InviteToChannelRequest)
api_id = 12345
api_hash = '123abc123'
client = TelegramClient('test1', api_id, api_hash)
client.start()
client(...
-1
votes
1
answer
39
views
Python script stops at error instead of carrying on
I am using Telethon for a telegram bot.
I've got a list of phone numbers. If the phone number is valid then to run a script, if it is invalid I want it to check another number.
This is the part of ...
1
vote
1
answer
69
views
RuntimeError: Event loop is closed after main coroutine is completed
I've checked all similar questions and suggestions, including this one, but hadn't found a working solution.
I'm developing a telegram bot. If I test it manually, it works as expected. But my code ...
0
votes
1
answer
49
views
Telethon error when import InputPeerChannel
I just started learning python. Now I'm doing a bot for Telegram. To work with the Core API, I use the Telethon library for Python 3. The error occurs in the line:
from telethon.utils import ...
0
votes
0
answers
42
views
Telethon get message buttons with python
Is there a way to get the URL or/and text of a button below the message?
I'm using telethon with python.
-1
votes
0
answers
32
views
Telethon V2 Telegram Scrapper
im ussing This Scrapper, but not works with big groups.
In a stackoverflow post somebody solve it upgrading telethon to V2, but in V2 some modules is changed...and the functions of source code not ...
-1
votes
0
answers
25
views
How to forward a message with telethon without headers?
I need to forward a file to another chat..
but messages are like From chat ..
It have headers...
How to sent without header?
I nees like just sent the file from another chat without headers ...
0
votes
0
answers
52
views
Bot does not send media telethon
I'm making a bot that displays new messages from different chats to the user. The first client, acting as a user, listens to the channels, and the second client, acting as a bot, displays a new ...
0
votes
0
answers
26
views
telethon.errors.rpcerrorlist.BotMethodInvalidError
The first time I touched Telethon, I changed the api_id and api_hash, and then ran the program, but the following error was reported:
Traceback (most recent call last):
File "scraper.py", ...
0
votes
0
answers
54
views
how do i run a telethon async function in multiprocessing in python
Am trying to run an async telethon function under multiprocessing but i don't know how to blend the two together.
i have Googled, search and ask but it seems like there is no topic like this on the ...