Skip to main content

channels.leaveChannel

Leave a channel/supergroup

func (c *Client) ChannelsLeaveChannel(ctx context.Context, channel InputChannelClass) (UpdatesClass, error)

Calling this method

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

res, err := api.ChannelsLeaveChannel(ctx, channel)
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters

NameTypeRequiredDescription
ChannelInputChannelClassyesChannel/supergroup to leave

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400CHANNEL_INVALIDThe provided channel is invalid.
406CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
403CHANNEL_PUBLIC_GROUP_NAchannel/supergroup not available.
400CHAT_INVALIDInvalid chat.
400MSG_ID_INVALIDInvalid message ID provided.
400USER_BANNED_IN_CHANNELYou're banned from sending messages in supergroups/channels.
400USER_CREATORFor channels.editAdmin: you've tried to edit the admin rights of the owner, but you're not the owner; for channels.leaveChannel: you can't leave this channel, because you're its creator.
400USER_NOT_PARTICIPANTYou're not a member of this supergroup/channel.

References