how to fix please enter your phone (bot or token)
I cknow you are supposed to use connect instead of start but how
Hey, that's not how you ask a question! If you want helpful advice (or any response at all) read this first and then ask again. If you have the time, How To Ask Questions The Smart Way is another wonderful resource worth reading.
Читать полностью…if event.private:
print("private")
elif event.group:
print("group")
elif event.channel:
print("channel")
elif event.bot:
print("bot")
yeah, well if that's the only way then that's good.
and how to determine the type of source where the message came from? in the event it's all signed as a channel. what do you need to get from the event to understand the exact type of source?
Is it normal that I can't get all the information about a message at once in an event by printing it? For example, I see the text in the event but I don't see the author's name
Читать полностью…My favourite is Telethon
There isn't anything that that's possible in Telegram and impossible with Telethon
Hi and welcome to the group. Before asking any questions, please read the rules from the group's description, and don't forget to read the docs. Make sure you are using the latest version with pip3 install -U telethon
, since most problems have already been fixed in newer versions.
in many chats messages can be instantly deleted by keywords and I need to catch these deleted messages. but I'm afraid that teleton will miss them.
I have a similar bot on payogram, but it has a problem, after some time of work it itself for unknown reasons loses connection with telegram and I don't understand how to solve this. so I want to try teleton
I was trying to catch messages in both small and large chats and I noticed that in small ones the event comes instantly, but in large ones it doesn't come right away.
I also noticed a pattern that if there was a message in a large chat, the bot didn't catch it, but if after that I write in a small chat from another account, then the event comes right away from both the large and small chats...
i have a question
i use a telethon library for parsing channel. i’ve a message handler with event.NewMessage event tag. sometimes method got message with 1 second delay, after message published to channel, but sometimes it’s took about 40-60 seconds . Can you take me advice to minimise delay please :(
i am trying to open a bot referal link using telethon and it keeps giving error that it cant be opened the bot link is "/channel/en_referralbot?start=54961" type. any help appreciated
Читать полностью…You can filter events by passing func = lambda e : e.is_private
to events.NewMessage
Wdym author's name?!
You have to use Message.get_sender() or the property Message.sender to access the sender
client = TelegramClient(phone, api_id, api_hash)Читать полностью…
async def handle_new_message(event):
message = event.message.text
print(message)
async def main():
async with client:
client.add_event_handler(handle_new_message, events.NewMessage())
await client.run_until_disconnected()
if __name__ == '__main__':
asyncio.run(main())
You can try to discover when that delay comes in which line though, I don't need your code anyway
Читать полностью…