Add /secret and /group commands

This commit is contained in:
bodqhrohro 2019-12-08 01:36:29 +02:00
parent 58aefc5232
commit 5da39f4aa9

View file

@ -395,6 +395,34 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
if err != nil { if err != nil {
return err.Error(), true return err.Error(), true
} }
// create new secret chat with current user
case "secret":
_, user, err := c.GetContactByID(chatID, nil)
if err != nil || user == nil {
return "User not found", true
}
_, err = c.client.CreateNewSecretChat(&client.CreateNewSecretChatRequest{
UserId: int32(chatID),
})
if err != nil {
return err.Error(), true
}
// create group chat with current user
case "group":
if len(args) < 1 {
return notEnoughArguments, true
}
if chatID > 0 {
_, err := c.client.CreateNewBasicGroupChat(&client.CreateNewBasicGroupChatRequest{
UserIds: []int32{int32(chatID)},
Title: args[0],
})
if err != nil {
return err.Error(), true
}
}
case "help": case "help":
return helpString(helpTypeChat), true return helpString(helpTypeChat), true
default: default: