Dituon / petpet

根据模板生成图像
http://d2n.moe/petpet/
GNU Affero General Public License v3.0
310 stars 81 forks source link

fix(Plugin): allow response to images sent by other Onebot clients when using Overflow with LLonebot #122

Closed Natsukage closed 4 weeks ago

Natsukage commented 4 weeks ago

Overflow 项目 中关于自己发送的消息会广播为 GroupMessageSyncEvent 事件而非 GroupMessageEvent 事件。通过监听 GroupMessageSyncEvent 事件,使得 petpet 项目可以正确处理并响应来自其他 Onebot 客户端发送的图片。

if (member.id == bot.id) {
    bot.logger.verbose("[SYNC] [${group.name}(${group.id})] <- $messageString")
    @Suppress("DEPRECATION") // TODO: 无法获取到哪个客户端发送的消息
    bot.eventDispatcher.broadcastAsync(GroupMessageSyncEvent(
        group, miraiMessage, member, member.nameCardOrNick, messageSource.time
    ))
} else {
    bot.logger.verbose("[${group.name}(${group.id})] ${member.nameCardOrNick}(${member.id}) -> $messageString")
    bot.eventDispatcher.broadcastAsync(GroupMessageEvent(
        member.nameCardOrNick, member.permission, member, miraiMessage, messageSource.time
    ))
}
vercel[bot] commented 4 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
petpet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2024 2:16pm