diff options
author | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-03 03:32:53 +0300 |
---|---|---|
committer | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-03 03:32:53 +0300 |
commit | 90f0490e1626f3e0cd753caa5a4aac7787cb6dfc (patch) | |
tree | 08127d54f25c1e18b5dacc2f4ca3f011f224c5d1 /telegram/utils.go | |
parent | 40b3c6a76884576dc4e3b81891c9c693c7882bab (diff) |
Support commands in mapped chats
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index 7e9882d..d98cfb0 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -405,6 +405,15 @@ func (c *Client) messageToPrefix(message *client.Message, fileString string) str return strings.Join(prefix, " | ") } -func (c *Client) ProcessOutgoingMessage(chatID int, text string, messageID int) { - // TODO +// ProcessOutgoingMessage executes commands or sends messages to mapped chats +func (c *Client) ProcessOutgoingMessage(chatID int, text string, messageID int, returnJid string) { + if strings.HasPrefix(text, "/") { + response, isCommand := c.ProcessChatCommand(text) + if response != "" { + gateway.SendMessage(returnJid, strconv.Itoa(int(chatID)), response, c.xmpp) + } + if isCommand { + return + } + } } |