fix(line): capture QuoteToken for all message types and handle location
- Store QuoteToken for image, video, and sticker messages (not just text) - Add webhook.LocationMessageContent case to forward as [location] placeholder Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
41d6156dce
commit
6d7d1b0909
1 changed files with 18 additions and 0 deletions
|
|
@ -231,6 +231,10 @@ func (c *LINEChannel) processEvent(event webhook.EventInterface) {
|
||||||
}
|
}
|
||||||
case webhook.ImageMessageContent:
|
case webhook.ImageMessageContent:
|
||||||
messageID = msg.Id
|
messageID = msg.Id
|
||||||
|
if msg.QuoteToken != "" {
|
||||||
|
quoteToken = msg.QuoteToken
|
||||||
|
c.quoteTokens.Store(chatID, msg.QuoteToken)
|
||||||
|
}
|
||||||
if localPath := c.downloadContent(msg.Id, "image.jpg"); localPath != "" {
|
if localPath := c.downloadContent(msg.Id, "image.jpg"); localPath != "" {
|
||||||
scope := channels.BuildMediaScope("line", chatID, msg.Id)
|
scope := channels.BuildMediaScope("line", chatID, msg.Id)
|
||||||
mediaPaths = append(mediaPaths, storeMedia(localPath, "image.jpg", scope))
|
mediaPaths = append(mediaPaths, storeMedia(localPath, "image.jpg", scope))
|
||||||
|
|
@ -245,6 +249,10 @@ func (c *LINEChannel) processEvent(event webhook.EventInterface) {
|
||||||
}
|
}
|
||||||
case webhook.VideoMessageContent:
|
case webhook.VideoMessageContent:
|
||||||
messageID = msg.Id
|
messageID = msg.Id
|
||||||
|
if msg.QuoteToken != "" {
|
||||||
|
quoteToken = msg.QuoteToken
|
||||||
|
c.quoteTokens.Store(chatID, msg.QuoteToken)
|
||||||
|
}
|
||||||
if localPath := c.downloadContent(msg.Id, "video.mp4"); localPath != "" {
|
if localPath := c.downloadContent(msg.Id, "video.mp4"); localPath != "" {
|
||||||
scope := channels.BuildMediaScope("line", chatID, msg.Id)
|
scope := channels.BuildMediaScope("line", chatID, msg.Id)
|
||||||
mediaPaths = append(mediaPaths, storeMedia(localPath, "video.mp4", scope))
|
mediaPaths = append(mediaPaths, storeMedia(localPath, "video.mp4", scope))
|
||||||
|
|
@ -253,8 +261,18 @@ func (c *LINEChannel) processEvent(event webhook.EventInterface) {
|
||||||
case webhook.FileMessageContent:
|
case webhook.FileMessageContent:
|
||||||
messageID = msg.Id
|
messageID = msg.Id
|
||||||
content = "[file]"
|
content = "[file]"
|
||||||
|
case webhook.LocationMessageContent:
|
||||||
|
messageID = msg.Id
|
||||||
|
content = "[location]"
|
||||||
|
if msg.Title != "" {
|
||||||
|
content = fmt.Sprintf("[location: %s]", msg.Title)
|
||||||
|
}
|
||||||
case webhook.StickerMessageContent:
|
case webhook.StickerMessageContent:
|
||||||
messageID = msg.Id
|
messageID = msg.Id
|
||||||
|
if msg.QuoteToken != "" {
|
||||||
|
quoteToken = msg.QuoteToken
|
||||||
|
c.quoteTokens.Store(chatID, msg.QuoteToken)
|
||||||
|
}
|
||||||
content = "[sticker]"
|
content = "[sticker]"
|
||||||
default:
|
default:
|
||||||
logger.DebugCF("line", "Ignoring unsupported message type", map[string]any{
|
logger.DebugCF("line", "Ignoring unsupported message type", map[string]any{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue