Giter VIP home page Giter VIP logo

nonebot-plugin-who-at-me's Introduction

NoneBotPluginLogo

NoneBotPluginText

nonebot-plugin-who-at-me

✨ 看看是谁又在艾特我 ✨

说明

你是否遇到过这种情景:你点进一个99+的QQ群,发现有人艾特/回复过你,你满心期待地去查看,结果腾讯告诉你消息过多无法定义到上下文。现在你只需要部署一个机器人卧底即可找出到底是谁艾特了你。

安装

通过pipnb安装; 需要协议端支持转发合并消息。

命令:

pip install nonebot-plugin-who-at-me
nb plugin install nonebot-plugin-who-at-me

配置

记得配置SUPERUSERS

reminder_expire_time 合并转发消息记录的超时时间, 单位为天

使用

(这里默认COMMAND_START为"/")

命令 描述
谁艾特我 查看到底是谁艾特了你
/clear_db 清理当前用户的消息记录
/clear_all 清理全部消息记录

结果将以合并转发形式发送

nonebot-plugin-who-at-me's People

Contributors

forchannot avatar lgc2333 avatar seafhmc avatar shacha086 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nonebot-plugin-who-at-me's Issues

一个指令方面的建议

COMMAND_START设置为空白后,语句里面只要包含了谁艾特我,就会触发指令,可否增加一个精确指令配置,减少误触?

[Bug] 艾特全体会触发actionfaild

03-19 21:37:08 [SUCCESS] nonebot | OneBot V11 2029172546 | [message.group.normal]: Message -347638706 from 2373492314@[群:717978851] '[at:qq=all] 排位'
03-19 21:37:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_who_at_me)
03-19 21:37:08 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_who_at_me) running complete
03-19 21:37:08 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_who_at_me) failed.
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\LittlePaimon\bot.py", line 40, in <module>
    nonebot.run(app="__mp_main__:app", access_log=False)
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\__init__.py", line 273, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 187, in run
    uvicorn.run(
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\uvicorn\main.py", line 569, in run
    server.run()
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\uvicorn\server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 628, in run_until_complete
    self.run_forever()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 316, in run_forever
    super().run_forever()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 595, in run_forever
    self._run_once()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1881, in _run_once
    handle._run()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\message.py", line 141, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
> File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\message.py", line 187, in _run_matcher     
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 732, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 707, in cher\matcher.py", line 707, in simple_run
    await handler(
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 108, in __c\__init__.py", line 108, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot_plugin_who_at_me\__init__.py", line 73, in t_me\__init__.py", line 73, in _
    await create_record(bot=bot, event=event, target_id=target_id)
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot_plugin_who_at_me\__init__.py", line 46, in t_me\__init__.py", line 46, in create_record
    await bot.get_group_member_info(
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\internal\adapter\bot.py", line 120, in callpter\bot.py", line 120, in call_api
    raise exception
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\internal\adapter\bot.py", line 98, in call_pter\bot.py", line 98, in call_api
    result = await self.adapter._call_api(self, api, **data)
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\adapters\onebot\v11\adapter.py", line 132, bot\v11\adapter.py", line 132, in _call_api
    return handle_api_result(await self._result_store.fetch(seq, timeout))
  File "C:\Users\Administrator\Desktop\LittlePaimon\.venv\lib\site-packages\nonebot\adapters\onebot\v11\utils.py", line 58, in bot\v11\utils.py", line 58, in handle_api_result
    raise ActionFailed(**result)
nonebot.adapters.onebot.v11.exception.ActionFailed: ActionFailed(data=None, echo='165', message='群员不存在', msg='MEMBER_NOT_F'群员不存在', msg='MEMBER_NOT_FOUND', retcode=100, status='failed', wording='群员不存在')  

群聊触发指令会显示所有群的@消息

感觉不太合理,一般来说用户在群聊问谁艾特我都是想知道这个群之前发了什么
可以改成群聊指令显示这个群里的记录,私聊显示所有记录

有时候会报错,不知是否是@全体成员的锅

File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot\message.py", line 428, in _run_matcher
   await matcher.run(bot, event, state, stack, dependency_cache)
 File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot\internal\matcher\matcher.py", line 842, in run
   await self.simple_run(bot, event, state, stack, dependency_cache)
 File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot\internal\matcher\matcher.py", line 817, in simple_run
   await handler(
 File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot\dependencies\__init__.py", line 106, in __call__
   return await cast(Callable[..., Awaitable[R]], self.call)(**values)
 File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot_plugin_who_at_me\__init__.py", line 73, in _
   await create_record(bot=bot, event=event, target_id=target_id)
 File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot_plugin_who_at_me\__init__.py", line 46, in create_record
   await bot.get_group_member_info(
 File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot\internal\adapter\bot.py", line 122, in call_api
   raise exception
 File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot\internal\adapter\bot.py", line 97, in call_api
   result = await self.adapter._call_api(self, api, **data)
 File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot\adapters\onebot\v11\adapter.py", line 144, in _call_api
   return handle_api_result(await self._result_store.fetch(seq, timeout))
 File "C:\Users\AppData\Local\Programs\Python\Python39\lib\site-packages\nonebot\adapters\onebot\v11\utils.py", line 58, in handle_api_result
   raise ActionFailed(**result)
nonebot.adapters.onebot.v11.exception.ActionFailed: ActionFailed(status='failed', retcode=1200, data=None, message='群成员all不存在', wording='群成员all不存在', echo='595')

部分成员报错

部分成员执行谁艾特我后报错,具体报错为:
nonebot.adapters.onebot.v11.exception.ActionFailed: <ActionFailed data=None, echo={'seq': 4854}, msg=EMPTY_NODES, retcode=100, status=failed, wording=未找到任何可发送的合并转发信息>
清除数据后回复正常
请问要怎么解决,或者如何加一个时限 比如3天之前的消息不返回?

clear_all

加入删除二次确认功能,说明命令触发的后果

使用三天后出现转发失败

使用三天后,一些聊天频率比较高的群出现发送失败的情况,go-cqhttp 端显示“合并转发(群)消息发送失败: 账号可能被风控”,聊天频率比较低的群可以正常用。推测应该是转发的条数太多导致。也许应该加个只检测发送两三天之内的艾特消息的限制?使用上也会方便很多。

clear_db失效

能够正常获取被@消息
clear_all成功
clear_db失效

Screenshot_2022-06-15-23-18-02-271_com.tencent.mobileqq.jpg

clear_db

建议/clear_db设置成在群内发送则清除在本群的记录
私聊发送则清除所有记录

card可能为None不能用len()

utils.py第16行,member["card"]的值可能为None,而None是没有长度的,故报错无法正确记录群昵称,建议直接判断是否存在card完事儿。另外,注意到头像是bot的头像,貌似伪造消息的时候没有正确写入uid?

对接拉格兰报错

02-25 22:19:26 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_who_at_me, lineno=36) failed.
Traceback (most recent call last):
  File "/home/lgc2333/Documents/qqbot-nb2/bot.py", line 70, in <module>
    nonebot.run()
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot/__init__.py", line 331, in run
    get_driver().run(*args, **kwargs)
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot/drivers/fastapi.py", line 201, in run
    uvicorn.run(
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/uvicorn/main.py", line 587, in run
    server.run()
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/uvicorn/server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/home/lgc2333/.pyenv/versions/3.11.4/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
  File "/home/lgc2333/.pyenv/versions/3.11.4/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot/message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 846, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 821, in simple_run
    await handler(
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot/dependencies/__init__.py", line 113, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot_plugin_who_at_me/__init__.py", line 69, in _
    await create_record(bot=bot, event=event, target_id=target_id)
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot_plugin_who_at_me/__init__.py", line 45, in create_record
    card = get_member_name(
  File "/home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages/nonebot_plugin_who_at_me/utils.py", line 16, in get_member_name
    return member["card"] if not len(member["card"]) == 0 else member["nickname"]
TypeError: object of type 'NoneType' has no len()
> ./.venv/bin/pip show nonebot-plugin-who-at-me
Name: nonebot-plugin-who-at-me
Version: 0.2.8
Summary: Find who on earth has ated you
Home-page: https://github.com/SEAFHMC/nonebot-plugin-who-at-me
Author: SEAFHMC
Author-email: [email protected]
License: MIT
Location: /home/lgc2333/Documents/qqbot-nb2/.venv/lib/python3.11/site-packages
Requires: nonebot-adapter-onebot, nonebot2, peewee, Pillow
Required-by:

可不可以设置成群启用啊

如果设置成所有人都能用的话会好一点吗,我想让所有的群友都能用到这个贴心的功能,但是又不想一个一个地在配置项里输入他们的QQ号o(╥﹏╥)o

可选on_keyword

部分群友看到[有人@我]但不知道有这个功能,会进来问一句类似“谁@我了”这样的话
可以加入可选模式:关键词匹配,让功能调用率变高

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.