MessageEntityMention?
I can get a User with client.get_entity(text) but I can't seem to get the input entity because of a missing hash
(what I'm trying to do is call EditAdminRequest on a mention from a new message event)
looks like get_input_entity works for some users but not others o_O
Is it sent in a large chat?
No, just a test chat with 2 users and the bot
"MessageEntityMention" is for usernames, get_input_entity always works on it since it makes a request if username wasn't seen before. and if get_entity works, get_input_entity works too, Show some code and screenshots if that's no the issue
Basically this: username = "@..." # gotten from MessageEntityMention # Works user = await client.get_entity(username) # TypeError: User without access_hash or min info cannot be input await client.get_input_entity(username) # ValueError: Could not find the input entity for PeerUser(user_id=...) (PeerUser). Please read https://docs.telethon.dev/en/stable/concepts/entities.html to find out more details. await self.client.get_input_entity(user) There's 2 users in that chat, if I @ myself, all of the above work fine, if I @ the other users I get the errors listed there
where does the "# Works" apply, the "client.get_entity"? if so print the "user" it returns, you can censor the unnecessary info
ye it's get_entity. this is the returned user (I redacted contact information): User( id=..., is_self=False, contact=False, mutual_contact=False, deleted=False, bot=False, bot_chat_history=False, bot_nochats=False, verified=False, restricted=False, min=False, bot_inline_geo=False, support=False, scam=False, apply_min_photo=True, fake=False, bot_attach_menu=False, premium=False, attach_menu_enabled=False, bot_can_edit=False, close_friend=False, stories_hidden=False, stories_unavailable=True, access_hash=None, first_name='...', last_name='...', username='...', phone=None, photo=None, status=UserStatusRecently(), bot_info_version=None, restriction_reason=[], bot_inline_placeholder=None, lang_code=None, emoji_status=None, usernames=[], stories_max_id=None )
i love the new code blocks (and teh support for syntax highlighting!) in telegram
How to send text like this?
Just add a language to the MessageEntityPre object
Welp, it's a server thing. you're not allowed to make requests with that user. InputPeerUserFromMessage may work replace message.sender_id with this user.id
what so special about that user? o_O
Not the user but you, and probably in that chat.
telethon.errors.rpcerrorlist.FromMessageBotDisabledError Bots can't use fromMessage min constructors (caused by GetUsersRequest)
Yeah it's for real apps not bots, you just can't use usernames resolving then, try the other methods i mentioned, see if any of them deliver a User object with an access_hash
Hey could you send me a sample of this please? I don't know how to send messages like this
Обсуждают сегодня