diff --git a/telegram/commands.go b/telegram/commands.go index 3682535..91bc9d5 100644 --- a/telegram/commands.go +++ b/telegram/commands.go @@ -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: