Похожие чаты

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 ответов

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

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

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

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

а зачем этот вопрос для удаления из чата?
Mёdkinson Medvezhkin
63
using next image component with s3 image: "url" parameter is valid but upstream response is invalid code: <Image fill src={s...
Fasil
3
Эх кто-то пришел и весь праздник испортил :( You need complex FBX scene importing setup to change things on import? good luck with that. You need navigation and pathfinding? g...
Serg Gini
5
Friends, how can I find my Wazirx wallet address?
Silm Silm
31
Всем привет! Подскажите. Я написал приложение на Delphi 10.2 Tokyo под Windows 10. И передо мной стал вопрос о том чтобы сделать это приложение кроссплатформенным (под Linux и...
Дмитрий Завгородний
24
Какого хера? /Sources/App/Modules/User/Models/UserLinkApple.swift:21:20: warning: stored property '_id' of 'Sendable'-conforming class 'UserLinkApple' is mutable @ID(...
Alexander Sherbakov
13
My 7 year old daughter recognizes the Bitcoin symbol and knows it's currency. What are the top ,3-5 most basic important concepts to convey to a kid about BCH? I started with ...
Big Hair
24
How many Cashfusion server now?
Crypto life
22
But I'm wondering how exactly we can increase our chances of winning. Do you think it's just a matter of luck, or are there specific actions we need to take to qualify?
Luqman Ayman
12
Кто знает локации, где можно машину красиво отфоткать?
Lalalashechki Lalala
23
Карта сайта