Support ! prefix for commands in addition to /
This commit is contained in:
parent
915c40f1ee
commit
72b336a5f5
|
@ -138,6 +138,7 @@ func helpString(ht helpType) string {
|
||||||
str.WriteString("\n")
|
str.WriteString("\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
str.WriteString("\nYou may use ! instead of / if it conflicts with internal commands of a client")
|
||||||
|
|
||||||
return str.String()
|
return str.String()
|
||||||
}
|
}
|
||||||
|
|
|
@ -666,7 +666,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, returnJid str
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if returnJid != "" && strings.HasPrefix(text, "/") {
|
if returnJid != "" && (strings.HasPrefix(text, "/") || strings.HasPrefix(text, "!")) {
|
||||||
// try to execute commands
|
// try to execute commands
|
||||||
response, isCommand := c.ProcessChatCommand(chatID, text)
|
response, isCommand := c.ProcessChatCommand(chatID, text)
|
||||||
if response != "" {
|
if response != "" {
|
||||||
|
|
|
@ -89,7 +89,7 @@ func HandleMessage(s xmpp.Sender, p stanza.Packet) {
|
||||||
session.ProcessOutgoingMessage(toID, msg.Body, msg.From)
|
session.ProcessOutgoingMessage(toID, msg.Body, msg.From)
|
||||||
return
|
return
|
||||||
} else if msg.To == gatewayJid {
|
} else if msg.To == gatewayJid {
|
||||||
if strings.HasPrefix(msg.Body, "/") {
|
if strings.HasPrefix(msg.Body, "/") || strings.HasPrefix(msg.Body, "!") {
|
||||||
response := session.ProcessTransportCommand(msg.Body, resource)
|
response := session.ProcessTransportCommand(msg.Body, resource)
|
||||||
if response != "" {
|
if response != "" {
|
||||||
gateway.SendMessage(msg.From, "", response, component)
|
gateway.SendMessage(msg.From, "", response, component)
|
||||||
|
|
Loading…
Reference in a new issue