Add /add command

calls
bodqhrohro 4 years ago
parent 589876eef5
commit ea0d0df226

@ -334,6 +334,28 @@ func (c *Client) ProcessChatCommand(chatID int64, cmdline string) (string, bool)
text := regex.ReplaceAllString(messageText.Text.Text, strings.Join(args[1:], " "))
c.ProcessOutgoingMessage(chatID, text, message.Id, "")
// add @contact
case "add":
if len(args) < 1 {
return notEnoughArguments, true
}
chat, err := c.client.SearchPublicChat(&client.SearchPublicChatRequest{
Username: args[0],
})
if err != nil {
return err.Error(), true
}
if chat == nil {
return "No error, but chat is nil", true
}
gateway.SendPresence(
c.xmpp,
c.jid,
gateway.SPFrom(strconv.FormatInt(chat.Id, 10)),
gateway.SPType("subscribe"),
)
case "help":
return helpString(helpTypeChat), true
default:

Loading…
Cancel
Save