Skip to main content

messages.deleteChatUser

Deletes a user from a chat and sends a service message on it.

func (c *Client) MessagesDeleteChatUser(ctx context.Context, request *MessagesDeleteChatUserRequest) (UpdatesClass, error)

Calling this method

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

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

Parameters

NameTypeRequiredDescription
RevokeHistoryboolRemove the entire chat history of the specified user in this chat.
ChatIDint64yesChat ID
UserIDInputUserClassyesUser ID to be deleted

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
400CHAT_ID_INVALIDThe provided chat id is invalid.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400PEER_ID_INVALIDThe provided peer id is invalid.
400USER_ID_INVALIDThe provided user ID is invalid.
400USER_NOT_PARTICIPANTYou're not a member of this supergroup/channel.

References