Похожие чаты

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

76 просмотров

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

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

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

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
Карта сайта