telethonchat | Unsorted

Telegram-канал telethonchat - Telethon Chat

6095

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

what's this code even doing, topic_id is always equal to msg.id, topics don't become None unless the group has more than a million messages, ask Telegram to fix that then, otherwise, show the logic of your reply_to part

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

Telethon Chat

reply_to = await get_topic_entry_msg_id(group_id, topic_id)
if reply_to:
await send_with_rotation(gift, group_id, message, reply_to, buttons)
else:
logging.warning(f"⚠️ Can't reply topic id {topic_id} in {group_id}")

previous_availability[slug] = current

except Exception as e:
logging.error(f"❌ Error {slug}: {e}")

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

Telethon Chat

yep, will do.
thank you

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

Telethon Chat

the thing is I want my bot to be usable where only users can interact with each other

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

Telethon Chat

wait so channels can also be groups... I have to check if megagroup is true or not... what about gigagroup? its mentioned admin can change it so only they can send message, but can admins don't do that and group keep being a group?

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

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

it's a Telegram feature enabled in that public group. it doesn't have a link because you join by a button not by invite

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

Telethon Chat

I'm getting this while handling UpdateBotChatInviteRequester. Creating of the link for the bot and handling its invite link works fine.

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

Telethon Chat

/channel/TelethonChat/680057

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

Telethon Chat

Yes it worked again thank you

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

Telethon Chat

^exec async
from telethon.tl.functions.messages import ExportChatInviteRequest

entity = await client.get_entity('GiftClaimers')

print((await client(ExportChatInviteRequest(entity))).link)

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

Telethon Chat

Sorry i forgot it, thanks

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

Telethon Chat

How to get the private link of my group and also how to leave my group

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

Telethon Chat

Which method can I use to add a "stars" reaction to a message in Telegram

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

Telethon Chat

I really want to thank you, the migrate part works,

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

Telethon Chat

Is there any update? From the beginning I ran the bot never changed the code but here there are changes, and always fail and error

async def get_topic_entry_msg_id(group_id, topic_id):
try:
msg = await client.get_messages(group_id, ids=topic_id)
return msg.id if msg else None
except Exception as e:
logging.error(f"❌ Failed to take the topic id {topic_id} in {group_id}: {e}")
return None

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

Telethon Chat

2025-07-20 12:09:26,140 - ERROR - ❌ Cannot access chat mxeUbzpZ9cZlMGM1: No user has "mxeubzpz9czlmgm1" as username
2025-07-20 12:09:26,492 - INFO - Update id=329333527 is handled. Duration 860 ms by bot id=7859982967

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

Telethon Chat

Then ignore gigagroups they're small percentage of chats, same for channels

you should make a helper method to detect chat types more in depth, message.chat object is guaranteed to exist if event.is_channel which includes all the listed types in the docs. you match and ignore based on attributes

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

Telethon Chat

they don't matter, treat it as channel from a messaging pov

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

Telethon Chat

https://docs.telethon.dev/en/stable/concepts/chats-vs-channels.html#channels

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

Telethon Chat

Thank you! :)

P.S. I don't know who reported me for spam here, but I couldn't say thank you because of that 😂

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

Telethon Chat

Do you know when the second one is being used? What does Public Join Requests mean?

Did I get it right, that the second one doesn't have any attributes set at all?

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

Telethon Chat

ExportedChatInvite is their class/type. with two instances, ChatInviteExported / ChatInvitePublicJoinRequests, second object doesn't have a link field

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

Telethon Chat

Hi there!

I'm facing some strange issue with Telethon I can't figure out how it happened. I have a bot managing chat access. The bot creates its own invite link and ignores the rest of the invite links

I have a short code that fetches the invite link from the request:

@property
def invite_link(self) -> str | None:
if isinstance(self.original_update.invite, ChatInviteExported):
return self.original_update.invite.link

return None


In most cases it works just fine, but for some requests it raises an error:
AttributeError: 'ChatInvitePublicJoinRequests' object has no attribute 'link'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return self.original_update.invite.link
File "/app/community_manager/events/__init__.py", line 52, in invite_link
^^^^^^^^^^^^^^^^^
invite_link=event.invite_link,
File "/app/community_manager/handlers/chat.py", line 131, in handle_join_request
await callback(event)
File "/usr/local/lib/python3.11/site-packages/telethon/client/updates.py", line 570, in _dispatch_update
Traceback (most recent call last):
2025-07-16 18:19:26,065 - telethon.client.updates - ERROR - Unhandled exception on handle_join_request


From the documentation I see that invite should be a type of ChatInviteExported which has the same constructor as ChatInvitePublicJoinRequests. Therefore both should have link attribute

Do you know why could it miss link attribute in some cases and if it's an expected behavior that should be handled?

Thanks a lot :)

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

Telethon Chat

Executed Code 👑

from telethon.tl.functions.messages import ExportChatInviteRequest

entity = await client.get_entity('GiftClaimers')

print((await client(ExportChatInviteRequest(entity))).link)

💙Output:
/channel/+hpdljEmc_uo2ZTk0

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

Telethon Chat

Print(await client(ExportChatInviteRequest(entity)))
i am unable to get the link even with .link

python ChatInviteExported(link='/channel/+iVKmpW9XKfs1Mjdk', admin_id=7900050917, date=datetime.datetime(2025, 7, 16, 16, 48, 47, tzinfo=datetime.timezone.utc), revoked=False, permanent=False, request_needed=False, start_date=None, expire_date=None, usage_limit=None, usage=None, requested=None, subscription_expired=None, title=None, subscription_pricing=None)

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

Telethon Chat

/channel/TelethonChat/677960

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

Telethon Chat

/channel/TelethonChat/628856

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

Telethon Chat

By making the int(chat_id) and as you told me by making await them

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

Telethon Chat

start by awaiting the client calls

and spam reported accounts are unlikely to create Chat groups too same as supergroups

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