gramjs icon indicating copy to clipboard operation
gramjs copied to clipboard

Trying to ban/kick a user from a channel with a bot admin of the channel

Open ljs19923 opened this issue 2 years ago • 1 comments

Hi guys,

Im trying to kick a user from a channel with a bot admin of the channel. Everything was good before ( 1 month ago ) but I know I got this error :

Could not find the input entity for {"userId":"5522131067","className":"PeerUser"}. Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.

var tgId = "5522131067" This is my code : await client.invoke( new Api.channels.EditBanned({ channel: "-1001697705555", participant: tgId, bannedRights: new Api.ChatBannedRights({ viewMessages: true, }), }) );

await client.invoke( new Api.channels.EditBanned({ channel: "-1001697705555", participant: tgId, bannedRights: new Api.ChatBannedRights({ viewMessages: false, }), }) );

If you have any suggestions. Again this code worked 1 month ago

ljs19923 avatar Sep 16 '22 10:09 ljs19923

Are you sure you're trying this code with a bot not a user?. Make sure you're using the correct bot to do this. (the bot needs to be in the channel that the user is in). Make sure that the ID is correct.

that's generally all you need to take care of if you're using a bot.

painor avatar Sep 16 '22 18:09 painor