Похожие чаты

Does anyone know how to get a InputPeerUser from a

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)

17 ответов

65 просмотров
𝔾𝕝𝕒𝕩-🇪🇺 Автор вопроса

looks like get_input_entity works for some users but not others o_O

Is it sent in a large chat?

𝔾𝕝𝕒𝕩-🇪🇺 Автор вопроса
⎞ .·. ⎝ ⎝
Is it sent in a large chat?

No, just a test chat with 2 users and the bot

𝔾𝕝𝕒𝕩 🇪🇺
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

𝔾𝕝𝕒𝕩 🇪🇺
Basically this: username = "@..." # gotten from M...

where does the "# Works" apply, the "client.get_entity"? if so print the "user" it returns, you can censor the unnecessary info

𝔾𝕝𝕒𝕩-🇪🇺 Автор вопроса
⎞ .·. ⎝ ⎝
where does the "# Works" apply, the "client.get_en...

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 )

𝔾𝕝𝕒𝕩 🇪🇺
ye it's get_entity. this is the returned user (I r...

i love the new code blocks (and teh support for syntax highlighting!) in telegram

Python Developer
How to send text like this?

Just add a language to the MessageEntityPre object

𝔾𝕝𝕒𝕩 🇪🇺
ye it's get_entity. this is the returned user (I r...

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.

𝔾𝕝𝕒𝕩-🇪🇺 Автор вопроса
⎞ .·. ⎝ ⎝
Welp, it's a server thing. you're not allowed to m...

telethon.errors.rpcerrorlist.FromMessageBotDisabledError Bots can't use fromMessage min constructors (caused by GetUsersRequest)

𝔾𝕝𝕒𝕩 🇪🇺
telethon.errors.rpcerrorlist.FromMessageBotDisable...

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

𝔾𝕝𝕒𝕩 🇪🇺
ye it's get_entity. this is the returned user (I r...

Hey could you send me a sample of this please? I don't know how to send messages like this

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта