Skip to main content

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

NameTypeRequiredDescription
ChannelInputChannelClassyesSupergroup or channel
UsernamestringyesUsername
ActiveboolyesWhether to activate or deactivate the username

Returns

bool

Possible errors

CodeTypeDescription
400CHANNEL_INVALIDThe provided channel is invalid.
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
400CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
400CHAT_NOT_MODIFIEDNo changes were made to chat information because the new information you passed is identical to the current information.
400USERNAMES_ACTIVE_TOO_MUCHThe maximum number of active usernames was reached.
400USERNAME_INVALIDThe provided username is not valid.
400USERNAME_NOT_MODIFIEDThe username was not modified.

References