Basically I have a group(of which I am admin) in which I want to be able to add and kick-out user programmatically. I created a telegram app using my telegram account. I wanted to access the method channels.EditBanned
. The group was created using same account that was used to create app. This one:
new Api.channels.EditBanned({
channel: "Test_Channel",
participant: "vishalkale151071",
bannedRights: new Api.ChatBannedRights({
untilDate: 43,
viewMessages: 0,
sendMessages: 1,
sendMedia: true,
sendStickers: true,
sendGifs: false,
sendGames: true,
sendInline: true,
sendPolls: true,
changeInfo: true,
inviteUsers: true,
pinMessages: true,
}),
})
);
But got error :
RPCError: 403: CHAT_WRITE_FORBIDDEN (caused by channels.EditBanned)
Reference : https://gram.js.org/tl/channels/EditBanned
2
Answers
to ban/kick someone you can use:
to get the channel accessHash and id, you must store the result when you call the createChannel:
Ok . Since I had a deadline for the project , I ended up achieving the delete functionality by creating a bot and invoking bot.banMember method . For this to work one need to add the bot to the telegram group with admin privileges . also I feel its much simpler this way . Apart from directly messaging users in telegram , you can pretty much do everything . –