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

If in my decorator codes there were any wrapper then it will include all of *args and **kwards that makes lambda unuseful

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

Telethon Chat

Lambda is simply anon func

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

Telethon Chat

hello guys
I have a request for development on teleton, but there are several points that previous coders could not solve, namely, they could not implement viewing telegram stories from the list of usernames from txt and also directly from the group list.
if you have experience with something similar, I will be glad to discuss it in private messages, it is advisable to find an adequate experienced performer,
preferably Russian-speaking

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

Telethon Chat

Check if group is private or no
Then simply implement what you need your self

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

Telethon Chat

I would do it myself simply

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

Telethon Chat

No, I checked this, they are simple users, I think the problem is the chat supergroup

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

Telethon Chat

hi
In some events, strangely, users do not have username or usernames
But when I check through Telegram, they have usernames!

i use this code:

    sender = await event.get_sender()
print(sender.username, sender.usernames)

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

Telethon Chat

https://docs.telethon.dev/en/stable/modules/events.html#telethon.events.callbackquery.CallbackQuery

How can I filter from_users in his EventUpdateBuilder ?
I saw both data and pattern parameters can recieve a callable but I don't know how should be its input ( like lambda event : .... or not ? ) and which one should I choose ( data or pattern parameter )

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

Telethon Chat

I was just curious about how it can be done most natively :)

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

Telethon Chat

answering to myself:
it's possible to define separate html tag in extensions/html.py with args['collapsed'] = True so that it would pass the flag to an entity and it would show correctly, but for some reason I was unable to adopt TG representation of a tag <blockquote expandable></blockquote>, so I settled with <blockexp></blockexp>

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

Telethon Chat

I'm trying something like this but it's not being executed (the log.message)

    try:
c.bot.run_until_disconnected()
finally:
logger.info("Force flushing before shutdown!")
c.bot.loop.run_until_complete(db.flush_task(force=1))

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

Telethon Chat

ye, like this api id is published u cant use

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

Telethon Chat

why don't you just update the library

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

Telethon Chat

adding collapsed bool to a types.MessageEntityBlockquote class, based on examples for other types...

here's patched class:

class MessageEntityBlockquote(TLObject):
CONSTRUCTOR_ID = 0x20df5d0
SUBCLASS_OF_ID = 0xcf6419dc

def __init__(self, offset: int, length: int, collapsed: Optional[bool]=None):
"""
Constructor for MessageEntity: Instance of either MessageEntityUnknown, MessageEntityMention, MessageEntityHashtag, MessageEntityBotCommand, MessageEntityUrl, MessageEntityEmail, MessageEntityBold, MessageEntityItalic, MessageEntityCode, MessageEntityPre, MessageEntityTextUrl, MessageEntityMentionName, InputMessageEntityMentionName, MessageEntityPhone, MessageEntityCashtag, MessageEntityUnderline, MessageEntityStrike, MessageEntityBankCard, MessageEntitySpoiler, MessageEntityCustomEmoji, MessageEntityBlockquote.
"""
self.offset = offset
self.length = length
self.collapsed = collapsed

def to_dict(self):
return {
'_': 'MessageEntityBlockquote',
'offset': self.offset,
'length': self.length,
'collapsed': self.collapsed
}

def _bytes(self):
return b''.join((
b'\xd0\xf5\r\x02',
struct.pack('<i', self.offset),
struct.pack('<i', self.length),
struct.pack('<I', (0 if self.collapsed is None or self.collapsed is False else 1)),
))

@classmethod
def from_reader(cls, reader):
flags = reader.read_int()

_collapsed = bool(flags & 1)
_offset = reader.read_int()
_length = reader.read_int()
return cls(offset=_offset, length=_length, collapsed=_collapsed)

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

Telethon Chat

After the action, the account continues to remain online. Maybe it sends some requests and catches the ban?

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

Telethon Chat

No difference in them for your usecase

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

Telethon Chat

Pass your filter as pattern, it should return Bool

Now see if it works or not

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

Telethon Chat

This problem is related to some supergroups with many members, other groups do not have this problem.

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

Telethon Chat

I think this problem is a bit strange because when users reply to me, telethon displays the username correctly, but when the same user sends a message in the same group normally, it shows the username as None.

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

Telethon Chat

It's related to what get_sender returns

Info about group or user

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

Telethon Chat

It's when user buy usernames from fragment

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

Telethon Chat

I mean a query.user_id for from_users
If Telethon doesn't support something like this please let me know for me to coding a private decorator to use

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

Telethon Chat

thanks for your help though!

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

Telethon Chat

you don't necessarily need to modify the library or use html.

adjust the wiki hyperlink hack for quotes too, so something like this for markdown case

used as usual urls [text](quote) or [text](quote-collapse) or whatever

of course after doing client.parse_mode = CustomMarkdown()

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

Telethon Chat

well ok, it was pretty dumb of me to not update first :P

but still... how do I write the code to indicate I want a collapsed quote?..

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

Telethon Chat

How can I force a final task before shutdown?

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

Telethon Chat

Do you get an error?

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

Telethon Chat

cant use account's api id, idk why

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

Telethon Chat

I said based on my experience

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

Telethon Chat

I suggest using account's api id and api hash

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