Похожие чаты

File "/home/tgcleaning/TGCleaner/bot/helper/__init__.py", line 248, in kick_user

await self.client.kick_participant(entity=chat_id,
File "/home/tgcleaning/TGCleaner/virtualenv/lib/python3.11/site-packages/telethon/client/chats.py", line 1171, in kick_participant
resp = await self(functions.channels.EditBannedRequest(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tgcleaning/TGCleaner/virtualenv/lib/python3.11/site-packages/telethon/client/users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tgcleaning/TGCleaner/virtualenv/lib/python3.11/site-packages/telethon/client/users.py", line 87, in _call
result = await future
^^^^^^^^^^^^
telethon.errors.rpcerrorlist.ChatWriteForbiddenError: You can't write in this chat (caused by EditBannedRequest)
Why it raises ChatWriteForbiddenError when i'm trying to kick user?

14 ответов

81 просмотр

Debug it hard enough. start by confirming get_entity(chat_id).left isn't True

Are you the chat admin?

Kelevra- Автор вопроса
AH⁻64 Aᴘᴀᴄʜᴇ
Are you the chat admin?

ChatAdminRequiredError not raised

Kelevra
ChatAdminRequiredError not raised

Well, more fundamentally, non admins cannot ban, mute or restrict permissions of another user of the chat (provided they're both members of the chat). So even if no error is raised, you cannot do admin actions. But I guess that is likely not your issue. Right?

Kelevra- Автор вопроса

When i was not admin, it raised ChatAdminRequiredError, but not now

Kelevra
When i was not admin, it raised ChatAdminRequiredE...

Do you have permissions to ban users? Is this your own test chat with your own accounts or is it some group that you were promoted to admin in?

Kelevra- Автор вопроса
AH⁻64 Aᴘᴀᴄʜᴇ
Do you have permissions to ban users? Is this your...

Probably im not in chat, but should be there another exception?

Kelevra
Probably im not in chat, but should be there anoth...

Ok for me attempting to ban a user in a chat where I am not an admin gives the following error, I'll try the other thing too telethon.errors.rpcerrorlist.ChatAdminRequiredError: Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group (caused by EditBannedRequest)

Kelevra
Probably im not in chat, but should be there anoth...

Now I did it for a person in a chat where I am not even there, and I get the same error

⎞ .·. ⎝ ⎝
ChatAdminRequired applies to chats you have joined

So, Case 1: I and the other user is in the same chat. I am not an admin. I get the ChatAdminRequiredError. Case 2: I am not in the chat where the other user is. I am not an admin (obviously). I still get the ChatAdminRequiredError. How?

AH⁻64 Aᴘᴀᴄʜᴇ
So, Case 1: I and the other user is in the same ch...

pics or it didn't happen for the one you didn't join, print(get_entity(chat_id).left) followed by its error

⎞ .·. ⎝ ⎝
pics or it didn't happen for the one you didn't ...

AAAAH my bad. For case 2, I checked channel instead of the associated chat for that one. I got this error instead telethon.errors.rpcerrorlist.ChatWriteForbiddenError: You can't write in this chat (caused by EditBannedRequest)

Kelevra- Автор вопроса
AH⁻64 Aᴘᴀᴄʜᴇ
AAAAH my bad. For case 2, I checked channel instea...

And is it valid exception for this case? I think - no

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
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
Карта сайта