channels.toggleUsername
Activate or deactivate a purchased fragment.com username associated to a supergroup or channel we own.
func (c *Client) ChannelsToggleUsername(ctx context.Context, request *ChannelsToggleUsernameRequest) (bool, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.ChannelsToggleUsername(ctx, &tg.ChannelsToggleUsernameRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // bool
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
Channel | InputChannelClass | yes | Supergroup or channel |
Username | string | yes | Username |
Active | bool | yes | Whether to activate or deactivate the username |
Returns
bool
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | CHANNEL_INVALID | The provided channel is invalid. |
| 400 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |
| 400 | CHAT_ADMIN_REQUIRED | You must be an admin in this chat to do this. |
| 400 | CHAT_NOT_MODIFIED | No changes were made to chat information because the new information you passed is identical to the current information. |
| 400 | USERNAMES_ACTIVE_TOO_MUCH | The maximum number of active usernames was reached. |
| 400 | USERNAME_INVALID | The provided username is not valid. |
| 400 | USERNAME_NOT_MODIFIED | The username was not modified. |
References
- Official documentation
- Generated Go reference
- TL definition:
channels.toggleUsername#50f24105