fix(onebot): use prefixed chatID for group reply routing
When an incoming group message is received, the inbound context ChatID was set to the raw group number without the group: prefix. This caused the outbound reply to use send_private_msg instead of send_group_msg. Fix by using the prefixed chatID as inbound context ChatID. Closes #3002
This commit is contained in:
parent
5224b9a4bc
commit
32ea611f0c
1 changed files with 1 additions and 4 deletions
|
|
@ -995,7 +995,6 @@ func (c *OneBotChannel) handleMessage(raw *oneBotRawEvent) {
|
||||||
|
|
||||||
senderID := strconv.FormatInt(userID, 10)
|
senderID := strconv.FormatInt(userID, 10)
|
||||||
var chatID string
|
var chatID string
|
||||||
var contextChatID string
|
|
||||||
var contextChatType string
|
var contextChatType string
|
||||||
|
|
||||||
metadata := map[string]string{}
|
metadata := map[string]string{}
|
||||||
|
|
@ -1007,13 +1006,11 @@ func (c *OneBotChannel) handleMessage(raw *oneBotRawEvent) {
|
||||||
switch raw.MessageType {
|
switch raw.MessageType {
|
||||||
case "private":
|
case "private":
|
||||||
chatID = "private:" + senderID
|
chatID = "private:" + senderID
|
||||||
contextChatID = senderID
|
|
||||||
contextChatType = "direct"
|
contextChatType = "direct"
|
||||||
|
|
||||||
case "group":
|
case "group":
|
||||||
groupIDStr := strconv.FormatInt(groupID, 10)
|
groupIDStr := strconv.FormatInt(groupID, 10)
|
||||||
chatID = "group:" + groupIDStr
|
chatID = "group:" + groupIDStr
|
||||||
contextChatID = groupIDStr
|
|
||||||
contextChatType = "group"
|
contextChatType = "group"
|
||||||
metadata["group_id"] = groupIDStr
|
metadata["group_id"] = groupIDStr
|
||||||
|
|
||||||
|
|
@ -1080,7 +1077,7 @@ func (c *OneBotChannel) handleMessage(raw *oneBotRawEvent) {
|
||||||
|
|
||||||
inboundCtx := bus.InboundContext{
|
inboundCtx := bus.InboundContext{
|
||||||
Channel: c.Name(),
|
Channel: c.Name(),
|
||||||
ChatID: contextChatID,
|
ChatID: chatID,
|
||||||
ChatType: contextChatType,
|
ChatType: contextChatType,
|
||||||
SenderID: senderID,
|
SenderID: senderID,
|
||||||
MessageID: messageID,
|
MessageID: messageID,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue