Похожие чаты

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

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

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

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

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

30500 за редактор? )
Владимир
47
any reference of this implementation?
BitBuddha
29
Ⓐrtto, [4/23/24 7:02 PM] Please explain more fully how it is not working exactly, and what are the steps you are taking, and what error messages come or what happens. Ⓐrtto, ...
Ezza Kezza
2
sounds like people have lost their kaspa on tradeogre... does this mean tradeogre not trustworthy?
Ezza Kezza
15
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Alex Sherbakov
5
So much speculation in the last week. So much volatility in price. This is because Hedera has a GC that isn't using the network it's governing. Why aren't people asking why a...
Summit Seeker R
9
Anyone else having this error when trying to make transactions?
Datzel
11
Question: How viable is it to use Anvil as the backend infrastructure for managing a TradFi portfolio, while integrating Flexa for instant liquidity and payment solutions? Cou...
Kevin
2
вы делали что-то подобное и как? может есть либы готовые? увидел картинку нокода, где всё линиями соединено и стало интересно попробовать то же в ddl на lua сделать. решил с ч...
Victor
8
Карта сайта