Ailitonia / omega-miya

基于 nonebot2 的多平台机器人
MIT License
272 stars 50 forks source link

反撤回插件似乎没有用…? #157

Open wse320 opened 2 months ago

wse320 commented 2 months ago

在群里作为管理员使用/AntiRecall ON指令启动反撤回插件,返回消息 已设置 AntiRecall 反撤回功能开关为 'ON' 但是撤回没有任何效果…?去看日志也没有任何输出,是我使用方法不对吗

Ailitonia commented 2 months ago

能提供一下 DEBUG 级别的日志吗

wse320 commented 2 months ago

手动开关撤回功能


09-12 22:08:31 [SUCCESS] nonebot | OneBot V11 3**********4 | [message.group.normal]: Message 1309611315 from 4*********4@[群:6*********9] '/AntiRecall OFF'
09-12 22:08:31 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.onebot_v11_anti_recall.command, lineno=48)
09-12 22:08:31 [SUCCESS] onebot_v11_anti_recall | InternalEntity(type=onebot_v11_group, entity_id=6*********9, bot_id=3**********4) 设置 AntiRecall 反撤回功能开关为 off 成功
09-12 22:08:32 [INFO] nonebot | Matcher(type='message', module=src.plugins.onebot_v11_anti_recall.command, lineno=48) running complete
09-12 22:08:34 [SUCCESS] nonebot | OneBot V11 3**********4 | [message.group.normal]: Message 1842458737 from 4*********4@[群:6*********9] '/AntiRecall ON'
09-12 22:08:34 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.onebot_v11_anti_recall.command, lineno=48)
09-12 22:08:34 [SUCCESS] onebot_v11_anti_recall | InternalEntity(type=onebot_v11_group, entity_id=6*********9, bot_id=3**********4) 设置 AntiRecall 反撤回功能开关为 on 成功
09-12 22:08:34 [INFO] nonebot | Matcher(type='message', module=src.plugins.onebot_v11_anti_recall.command, lineno=48) running complete

尝试让群友撤回

09-12 22:08:50 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40)
09-12 22:08:50 [INFO] nonebot | Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40) running complete
09-12 22:09:44 [SUCCESS] nonebot | OneBot V11 3**********4 | [message.group.normal]: Message 1227512158 from 4*********4@[群:6*********9] '[at:qq=1091423084,name=wawei赋能40W单电机] 撤回条看看'
09-12 22:09:44 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40)
09-12 22:09:44 [INFO] nonebot | Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40) running complete
09-12 22:10:53 [SUCCESS] nonebot | OneBot V11 3**********4 | [message.group.normal]: Message 2031452980 from 1397704580@[ 群:6*********9] '南非和阿根廷以前都不是发达国家吧'
09-12 22:10:53 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40)
09-12 22:10:53 [INFO] nonebot | Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40) running complete
09-12 22:11:02 [SUCCESS] nonebot | OneBot V11 3**********4 | [message.group.normal]: Message 1588034286 from 1397704580@[ 群:6*********9] '还是类似澳大利亚这种'
09-12 22:11:02 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40)
09-12 22:11:02 [INFO] nonebot | Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40) running complete
09-12 22:11:09 [SUCCESS] nonebot | OneBot V11 3**********4 | [message.group.normal]: Message 841026816 from 1091423084@[群:6*********9] '不知道啊'
09-12 22:11:09 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40)
09-12 22:11:09 [INFO] nonebot | Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40) running complete
09-12 22:11:11 [SUCCESS] nonebot | OneBot V11 3**********4 | [notice.group_recall]: {'time': 1726150271, 'self_id': 3**********4, 'post_type': 'notice', 'notice_type': 'group_recall', 'user_id': 1091423084, 'group_id': 6*********9, 'operator_id': 1091423084, 'message_id': 841026816}
09-12 22:11:17 [SUCCESS] nonebot | OneBot V11 3**********4 | [message.group.normal]: Message 733112725 from 1091423084@[群:6*********9] '[image:file=88D15D5BFA1E4E364848E00ACE51A79D.jpg,subType=7,url=https://multimedia.nt.qq.com.cn/download?appid=1407&fileid=CgoxMDkx...,file_size=21943]'
09-12 22:11:17 [INFO] nonebot | Event will be handled by Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40)
09-12 22:11:17 [INFO] nonebot | Matcher(type='message', module=src.plugins.onebot_v11_group_repeater.common, lineno=40) running complete
09-12 22:11:22 [SUCCESS] nonebot | OneBot V11 3**********4 | [message.group.normal]: Message 342394691 from 1091423084@[群:6*********9] '弱智机器人'

可以看到group_recall那条消息之后啥反应都没有,去代码里看了有一个自己撤回的不触发的逻辑

async def check_recall_notice(bot: OneBotV11Bot, event: OneBotV11GroupRecallNoticeEvent, matcher: Matcher):
    user_id = event.user_id
    # 不响应自己撤回或由自己撤回的消息
    print(f'反撤回插件运行中,user_id:{user_id},event.self_id:{event.self_id}')
    logger.info(f'反撤回插件运行中,user_id:{user_id},event.self_id:{event.self_id}')
    if user_id == event.self_id or event.operator_id == event.self_id:
        logger.error('不响应自己撤回或由自己撤回的消息')
        return

,但是手动加上相关的logger也没输出,尬在这里了

Ailitonia commented 2 months ago

应该是这个版本重写的时候忘了适配撤回事件了😂

Ailitonia commented 2 months ago

Fixed in 64f265eb50c9eade514d689221f7ad2c811ba8e5

Ailitonia commented 2 months ago

已知缺陷: 使用 NapCatQQ 无法获取已撤回消息 NapNeko/NapCatQQ#354

zht163 commented 1 month ago

已知缺陷: 使用 NapCatQQ 无法获取已撤回消息 NapNeko/NapCatQQ#354

https://github.com/Ailitonia/omega-miya/commit/64f265eb50c9eade514d689221f7ad2c811ba8e5 那你这个是修了吗,获取不了已撤回的,就得自己记录每条消息的内容吧

Ailitonia commented 1 month ago

已知缺陷: 使用 NapCatQQ 无法获取已撤回消息 NapNeko/NapCatQQ#354

64f265e 那你这个是修了吗,获取不了已撤回的,就得自己记录每条消息的内容吧

有的协议端自带数据库的, 撤回消息也能获取到, 按需配置吧

Fixed in 9ab4bbe1ab4436b469f8f5832c1a76f7ac638cf2, 待合并