Add /add command

This commit is contained in:
bodqhrohro 2019-12-07 19:56:53 +02:00
parent 589876eef5
commit ea0d0df226

View file

@ -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: