|
|
|
@ -411,7 +411,7 @@ func (c *Client) messageToPrefix(message *client.Message, fileString string) str
|
|
|
|
|
|
|
|
|
|
// ProcessOutgoingMessage executes commands or sends messages to mapped chats
|
|
|
|
|
func (c *Client) ProcessOutgoingMessage(chatID int64, text string, messageID int64, returnJid string) {
|
|
|
|
|
if strings.HasPrefix(text, "/") {
|
|
|
|
|
if messageID == 0 && strings.HasPrefix(text, "/") {
|
|
|
|
|
// try to execute a command
|
|
|
|
|
response, isCommand := c.ProcessChatCommand(chatID, text)
|
|
|
|
|
if response != "" {
|
|
|
|
@ -430,6 +430,22 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, messageID int
|
|
|
|
|
|
|
|
|
|
log.Warnf("Send message to chat %v", chatID)
|
|
|
|
|
|
|
|
|
|
if messageID != 0 {
|
|
|
|
|
formattedText := &client.FormattedText{
|
|
|
|
|
Text: text,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// compile our message
|
|
|
|
|
message := &client.InputMessageText{
|
|
|
|
|
Text: formattedText,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c.client.EditMessageText(&client.EditMessageTextRequest{
|
|
|
|
|
ChatId: chatID,
|
|
|
|
|
MessageId: messageID,
|
|
|
|
|
InputMessageContent: message,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
// quotations
|
|
|
|
|
var reply int64
|
|
|
|
|
replySlice := replyRegex.FindStringSubmatch(text)
|
|
|
|
@ -452,6 +468,7 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, messageID int
|
|
|
|
|
text = text[newlinePos+1:]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
formattedText := &client.FormattedText{
|
|
|
|
|
Text: text,
|
|
|
|
|
}
|
|
|
|
@ -470,13 +487,6 @@ func (c *Client) ProcessOutgoingMessage(chatID int64, text string, messageID int
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if messageID != 0 {
|
|
|
|
|
c.client.EditMessageText(&client.EditMessageTextRequest{
|
|
|
|
|
ChatId: chatID,
|
|
|
|
|
MessageId: messageID,
|
|
|
|
|
InputMessageContent: message,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
c.client.SendMessage(&client.SendMessageRequest{
|
|
|
|
|
ChatId: chatID,
|
|
|
|
|
ReplyToMessageId: reply,
|
|
|
|
|