telethonchat | Unsorted

Telegram-канал telethonchat - Telethon Chat

6097

Official Telethon's chat! Rules: • Speak English • Stay on topic (questions about Telethon) • Be respectful • Don't ask to ask • Spam-related uses lead to ban • Read https://docs.telethon.dev before asking things here Read more about us @TelethonUpdates

Subscribe to a channel

Telethon Chat

That is not related to Telethon. Please move to a different group with the correct topic to continue that conversation

Читать полностью…

Telethon Chat

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.

Читать полностью…

Telethon Chat

Same as any other message

Читать полностью…

Telethon Chat

When I write the name of the book to the bot, I want it to send it to me as a pdf. How is this possible?

Читать полностью…

Telethon Chat

hello all! Question: why does telegram show the same emoji 🟰 in different ways in the same message?? (only on some mobile phones)

Читать полностью…

Telethon Chat

Hi, I really like the Silvia bot over here. I remember that it has a OS github. can someone share the link please?

Читать полностью…

Telethon Chat

I want to pass multiple patterns to a decorator
is it possible? if yes how?

I passed a list of patterns and didn't work

Читать полностью…

Telethon Chat

The example was for implicit updates that get sent to usual NewMessage handler by sever, you're not obliged to set the limit to 1 if you want to parse the difference new_messages, you can pass any number like 100

Читать полностью…

Telethon Chat

Thanks for the quick reply. The only problem I cannot deal with channel differencetoolong problem. It occurs when difference is more then 1 message. In this my case my code just skip this messages but I would like to get them as well. Here is code: import asyncio
from telethon.tl.functions.updates import GetChannelDifferenceRequest
from telethon.tl.types import ChannelMessagesFilterEmpty
from telethon.tl.functions.channels import GetFullChannelRequest
from telethon import TelegramClient,errors
from pprint import pprint

api_id = 1111
api_hash = 'aaaaaa'
client = TelegramClient('anon', api_id, api_hash)
client.start()

async def request_updates(chats):
# Get the initial "points in time" (pts) for each chat
pts = {chat: (await client(GetFullChannelRequest(chat))).full_chat.pts for chat in chats}

while True:
for chat in chats:
# Get channel differences for each chat
diff = await client(GetChannelDifferenceRequest(chat, ChannelMessagesFilterEmpty(), pts[chat], 1))

if hasattr(diff, 'new_messages'):
for message in diff.new_messages:
print (message.message)

if hasattr(diff, 'pts'):
pts[chat] = diff.pts
else:
pts[chat] += 1

# Sleep for a short duration between iterations
await asyncio.sleep(5)

# List of chat URLs to monitor
chat_urls = ["/channel/ourgroup444"]

# Run the Telethon client until it is disconnected
client.loop.run_until_complete(request_updates(chat_urls))

Читать полностью…

Telethon Chat

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.

Читать полностью…

Telethon Chat

Can I somehow limit it to one trigger?

Читать полностью…

Telethon Chat

anyway. if it runs as intended now, keep it as it is

Читать полностью…

Telethon Chat

The goal. not what you're doing now, are you trying to create album photo handler?

Читать полностью…

Telethon Chat

Be clearer. what is your goal

Читать полностью…

Telethon Chat

SaveGif has unsave=

Читать полностью…

Telethon Chat

🐎找收港澳六合彩的庄,每期一二十万单量🇭🇰🇲🇴

Читать полностью…

Telethon Chat

That is not related to Telethon. Please move to a different group with the correct topic to continue that conversation

Читать полностью…

Telethon Chat

If someone sends a text in code format, how could I read it?

Читать полностью…

Telethon Chat

the telegram app will stop changing emojis to the apps built-in emojis after a certain amount, and fallback to the system emoji font

Читать полностью…

Telethon Chat

https://github.com/LonamiWebs/Telethon/blob/v1/telethon_examples/assistant.py#L5

Читать полностью…

Telethon Chat

use regex, pattern="/(start|help)"

Читать полностью…

Telethon Chat

Because Telegram wants to. you can't do much about it, certain accounts or sessions when used under unofficial apps will get logged out to protect the account when doing certain actions or by just being logged in

Читать полностью…

Telethon Chat

After initialisation of my session i got log out from all devices. Why telegram did this? I literally can only call get_me() but it always happens

Читать полностью…

Telethon Chat

ok, I think I figured it out

@client.on(events.NewMessage(1234060895))
async def normal_handler(event):
if event.photo:
with open("id.txt", "r") as txt:
lines = txt.readlines()
for line in lines:
if str(event.photo.id) == line[:-1]:
await client.send_message(1234060895, '👎')
break
return
with open("id.txt", "a") as txt:
txt.write(str(event.photo.id) + '\n')
print(current_time, event.photo.id)

Читать полностью…

Telethon Chat

```@client.on(events.NewMessage(1234060895))
async def normal_handler(event):
if event.photo:
with open("id.txt", "r") as txt:
lines = txt.readlines()
for line in lines:
if str(event.photo.id) == line[:-1]:
await client.send_message(
1234060895, '👎')
return
with open("id.txt", "a") as txt:
txt.write(str(event.photo.id) + '\n')
print(current_time, event.photo.id)```

so that this is only executed once per message

Читать полностью…

Telethon Chat

throws more than one exception at a time, since it records all the photos from the message, and it seems that in the verification cycle it throws an exception for each matching record :(

Читать полностью…

Telethon Chat

I receive photos from the bot, sometimes several in one message, one message - one exception, ideally, all exceptions are written to a file, the bot can be repeated, so I need to compare each message with entries in the file in order to automatically respond to repetitions

Читать полностью…

Telethon Chat

where is return located, in this place I do not need to continue execution, but go into wait mode until the next event

or did I do everything right with "return"...

Читать полностью…

Telethon Chat

@client.on(events.NewMessage(1234060895))
async def normal_handler(event):
if event.photo:
with open("id.txt", "r") as txt:
lines = txt.readlines()
for line in lines:
if str(event.photo.id) == line[:-1]:
await client.send_message(1234060895, '👎')
return
with open("id.txt", "a") as txt:
txt.write(str(event.photo.id) + '\n')
print(current_time, event.photo.id)

how do I go to wait for the next message where return?

Читать полностью…

Telethon Chat

/channel/TelethonChat/579602

Читать полностью…
Subscribe to a channel