Skip to main content

channels.editBanned

Ban/unban/kick a user in a supergroup/channel.

func (c *Client) ChannelsEditBanned(ctx context.Context, request *ChannelsEditBannedRequest) (UpdatesClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.ChannelsEditBanned(ctx, &tg.ChannelsEditBannedRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters

NameTypeRequiredDescription
ChannelInputChannelClassyesThe supergroup/channel.
ParticipantInputPeerClassyesParticipant to ban
BannedRightsChatBannedRightsyesThe banned rights

Returns

UpdatesClass

Possible errors

CodeTypeDescription
406BANNED_RIGHTS_INVALIDYou provided some invalid flags in the banned rights.
400CHANNEL_INVALIDThe provided channel is invalid.
406CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
403CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
403CHAT_WRITE_FORBIDDENYou can't write in this chat.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MSG_ID_INVALIDInvalid message ID provided.
400PARTICIPANT_ID_INVALIDThe specified participant ID is invalid.
400PEER_ID_INVALIDThe provided peer id is invalid.
400USER_ADMIN_INVALIDYou're not an admin.
400USER_ID_INVALIDThe provided user ID is invalid.

References