Add /secret and /group commands

calls
bodqhrohro 4 years ago
parent 58aefc5232
commit 5da39f4aa9

@ -395,6 +395,34 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
if err != nil {
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":
return helpString(helpTypeChat), true
default:

Loading…
Cancel
Save