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
| Name | Type | Required | Description |
|---|---|---|---|
Channel | InputChannelClass | yes | Channel/supergroup to leave |
Returns
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | CHANNEL_INVALID | The provided channel is invalid. |
| 406 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |
| 403 | CHANNEL_PUBLIC_GROUP_NA | channel/supergroup not available. |
| 400 | CHAT_INVALID | Invalid chat. |
| 400 | MSG_ID_INVALID | Invalid message ID provided. |
| 400 | USER_BANNED_IN_CHANNEL | You're banned from sending messages in supergroups/channels. |
| 400 | USER_CREATOR | For 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. |
| 400 | USER_NOT_PARTICIPANT | You're not a member of this supergroup/channel. |
References
- Official documentation
- Generated Go reference
- TL definition:
channels.leaveChannel#f836aa95