Nonebot2 简易群管

Overview

nonebot

简易群管

NoneBot2 简易群管 _

踢 改 禁
欢迎issue pr

权限说明:permission=SUPERUSER

安装 💿

pip install nonebot-plugin-admin

导入 📲

bot.py 导入,语句: nonebot.load_plugin("nonebot_plugin_admin")

指令 💻

简易群管:
权限:permission=SUPERUSER
  禁言:
    /禁 @某人 时间(s)[1,2591999]
    /禁 @某人 缺省时间则随机
    /禁 @某人 0 可解禁
    /解 @某人
  全群禁言(好像没用?)
    /all 
    /all 解
  改名片
    /改 @某人 名片
  改头衔(又没用?)
    /头衔 @某人 头衔
    /删头衔
  踢出:
    /踢 @某人
  踢出并拉黑:
    /黑 @某人

给个star吧~

其他插件 it咨询 工作性价比

在线运行代码

截图 🖼

暂无

Comments
  • [BUG]无法初始化读取群号失败

    [BUG]无法初始化读取群号失败

    描述 bug 无法初始化

    如何复现

    1. 我通过文件夹载入方式安装并导入了插件
    2. 在 今天时候 启动情况下,出现了 无法初始化问题

    报错截图 (python的报错请截最下面)

    12-13 02:14:56 [ERROR] nonebot | Failed to import "nonebot_plugin_admin"
    Traceback (most recent call last):
      File "D:\NoneBot2\homura\bot.py", line 27, in <module>
        nonebot.load_from_toml("pyproject.toml")
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\plugin\load.py", line 122, in load_from_toml
        return load_all_plugins(plugins, plugin_dirs)
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\plugin\load.py", line 59, in load_all_plugins
        return manager.load_all_plugins()
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\plugin\manager.py", line 168, in load_all_plugins
        return set(
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\plugin\manager.py", line 169, in <genexpr>
        filter(None, (self.load_plugin(name) for name in self.available_plugins))
    > File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\plugin\manager.py", line 145, in load_plugin
        module = importlib.import_module(
      File "D:\conda_data\envs\Python3.8.15\lib\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\plugin\manager.py", line 233, in exec_module
        super().exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 843, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "D:\NoneBot2\homura\src\plugins\nonebot_plugin_admin\__init__.py", line 22, in <module>
        from . import (
      File "D:\NoneBot2\homura\src\plugins\nonebot_plugin_admin\approve.py", line 14, in <module>
        from .utils import load
      File "D:\NoneBot2\homura\src\plugins\nonebot_plugin_admin\utils.py", line 38, in <module>
        def At(data: str) -> Union[list[str], list[int], list]:
    TypeError: 'type' object is not subscriptable
    
    
    12-13 02:09:05 [ERROR] nonebot | Error when running WebSocketConnection hook. Running cancelled!
    Traceback (most recent call last):
      File "D:\NoneBot2\homura\bot.py", line 37, in <module>
        nonebot.run(app="__mp_main__:app")
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\__init__.py", line 273, in run
        get_driver().run(*args, **kwargs)
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\drivers\fastapi.py", line 172, in run
        uvicorn.run(
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\uvicorn\main.py", line 576, in run
        server.run()
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\uvicorn\server.py", line 60, in run
        return asyncio.run(self.serve(sockets=sockets))
      File "D:\conda_data\envs\Python3.8.15\lib\asyncio\runners.py", line 44, in run
        return loop.run_until_complete(main)
      File "D:\conda_data\envs\Python3.8.15\lib\asyncio\base_events.py", line 603, in run_until_complete
        self.run_forever()
      File "D:\conda_data\envs\Python3.8.15\lib\asyncio\windows_events.py", line 316, in run_forever
        super().run_forever()
      File "D:\conda_data\envs\Python3.8.15\lib\asyncio\base_events.py", line 570, in run_forever
        self._run_once()
      File "D:\conda_data\envs\Python3.8.15\lib\asyncio\base_events.py", line 1859, in _run_once
        handle._run()
      File "D:\conda_data\envs\Python3.8.15\lib\asyncio\events.py", line 81, in _run
        self._context.run(self._callback, *self._args)
    > File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\internal\driver\driver.py", line 146, in _run_hook
        await asyncio.gather(*coros)
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\utils.py", line 157, in run_coro_with_catch
        return await coro
      File "D:\conda_data\envs\Python3.8.15\lib\site-packages\nonebot\dependencies\__init__.py", line 108, in __call__
        return await cast(Callable[..., Awaitable[R]], self.call)(**values)
      File "D:\NoneBot2\homura\src\plugins\nonebot_plugin_admin\config.py", line 22, in _
        await utils.init()
    AttributeError: module 'src.plugins.nonebot_plugin_admin.utils' has no attribute 'init'
    

    环境

    • windows 11
    • Python 版本 略
    • Nonebot2 版本号 2.0.0r2
    • 在那里下载的本插件
      • github ( 基线 )

    其他内容 ...

    user's bug 
    opened by Sincejunly 15
  • [BUG]导入插件报错

    [BUG]导入插件报错

    12-19 23:58:19 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_makemidi" 12-19 23:58:19 [ERROR] nonebot | Failed to import "nonebot_plugin_admin" Traceback (most recent call last): File "", line 1, in File "C:\Program Files\python\lib\multiprocessing\spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "C:\Program Files\python\lib\multiprocessing\spawn.py", line 125, in _main prepare(preparation_data) File "C:\Program Files\python\lib\multiprocessing\spawn.py", line 236, in prepare _fixup_main_from_path(data['init_main_from_path']) File "C:\Program Files\python\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path main_content = runpy.run_path(main_path, File "C:\Program Files\python\lib\runpy.py", line 265, in run_path return _run_module_code(code, init_globals, run_name, File "C:\Program Files\python\lib\runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "C:\Program Files\python\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Administrator\Desktop\bot\mcqq\mcqq_bot\bot.py", line 29, in nonebot.load_plugin("nonebot_plugin_admin") File "C:\Program Files\python\lib\site-packages\nonebot\plugin\load.py", line 34, in load_plugin return manager.load_plugin(module_path)

    File "C:\Program Files\python\lib\site-packages\nonebot\plugin\manager.py", line 141, in load_plugin module = importlib.import_module(name) File "C:\Program Files\python\lib\importlib_init_.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "C:\Program Files\python\lib\site-packages\nonebot\plugin\manager.py", line 233, in exec_module super().exec_module(module) File "", line 783, in exec_module File "", line 219, in call_with_frames_removed File "C:\Program Files\python\lib\site-packages\nonebot_plugin_admin_init.py", line 22, in from . import ( File "C:\Program Files\python\lib\site-packages\nonebot_plugin_admin\approve.py", line 14, in from .utils import load File "C:\Program Files\python\lib\site-packages\nonebot_plugin_admin\utils.py", line 38, in def At(data: str) -> Union[list[str], list[int], list]: TypeError: 'type' object is not subscriptable

    系统版本和环境 win server 2019 python 3.8.6

    opened by Cloudwhile 13
  • [BUG]群词云报错

    [BUG]群词云报错

    描述 bug 救命啊,插件出现了群词云报错问题

    如何复现

    1. 我通过nb方式安装并导入了插件
    2. 在 正常 时候 正常运行 情况下,出现了 群云词报错 问题

    报错截图 (python的报错请截最下面) 这里放截图,可使用任何截图工具截图,然后在这里按下 ** Ctrl + V ** image

    环境

    • 操作系统 win10
    • Python 版本 3.9.13
    • Nonebot2 版本号 不知道
    • 在那里下载的本插件 nonebot商店
    • pypi (商店安装 或者 pip 安装(本质一样))
    • github ( 说明分支 )

    其他内容 ...

    user's bug Old Version 
    opened by zuixiaoxiao 11
  • 接收信息时报错

    接收信息时报错

    描述 bug 救命啊,插件出现了接收 信息报错 问题

    如何复现

    1. 我通过nb方式安装并导入了插件
    2. 在 接收信息 时候 正常 情况下,出现了 报错 问题

    报错截图 (python的报错请截最下面) 这里放截图,可使用任何截图工具截图,然后在这里按下 ** Ctrl + V ** image image

    环境

    • 操作系统 win10
    • Python 版本 3.9.13
    • Nonebot2 版本号 rc3
    • 在那里下载的本插件 nonebot商店
    • pypi (商店安装 或者 pip 安装(本质一样))
    • github ( 说明分支 ) main

    其他内容 ...

    bug 
    opened by zuixiaoxiao 8
  • 禁言功能存在 bug,使用`禁 @somebody`时无法工作

    禁言功能存在 bug,使用`禁 @somebody`时无法工作

    问题代码: https://github.com/yzyyz1387/nonebot_plugin_admin/blob/68452c114c0c52c107e6e7e3dff6ddecea8f8d5d/nonebot_plugin_admin/init.py#L41

    应改为:

    if len(msg.split()) > len(sb)+1:
    

    另外建议词云功能也像违禁词一样使用资源配置文件,并且考虑再创建一个 "custom" 文件来存储用户自定义的违禁词/词云忽略词,而且可以加个指令清除当前群的词云存储文件

    bug 产品经理 
    opened by tom-snow 8
  • 插件导入报错

    插件导入报错

    from nonebot.adapters.onebot.exception import ActionFailed ModuleNotFoundError: No module named 'nonebot.adapters.onebot.exception'

    nonebot-adapter-onebot已经安装过, 是不是跟我py版本3.8+有关系(还有机会适配py3.8+么)

    opened by NanakoOfficial 5
  • [BUG] 插件运行过程中邀请机器人加入群聊报错

    [BUG] 插件运行过程中邀请机器人加入群聊报错

    大概是开关未初始化之类吧

    03-17 18:18:53 [INFO] nonebot | Matcher <Matcher from plugins.nonebot_plugin_admin.group_request, type=request, priority=1, temp=False> running complete 03-17 18:18:53 [ERROR] nonebot | Running matcher <Matcher from plugins.nonebot_plugin_admin.group_request, type=request, priority=1, temp=False> failed. Traceback (most recent call last): File "D:\QQBot\NoneBot\bot.py", line 12, in nonebot.run() File "D:\Python39\lib\site-packages\nonebot_init_.py", line 258, in run get_driver().run(*args, **kwargs) File "D:\Python39\lib\site-packages\nonebot\drivers\fastapi.py", line 168, in run uvicorn.run( File "D:\Python39\lib\site-packages\uvicorn\main.py", line 463, in run server.run() File "D:\Python39\lib\site-packages\uvicorn\server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "D:\Python39\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "D:\Python39\lib\asyncio\base_events.py", line 629, in run_until_complete self.run_forever() File "D:\Python39\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "D:\Python39\lib\asyncio\base_events.py", line 596, in run_forever self._run_once() File "D:\Python39\lib\asyncio\base_events.py", line 1890, in _run_once handle._run() File "D:\Python39\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "D:\Python39\lib\site-packages\nonebot\message.py", line 153, in _check_matcher await run_matcher(Matcher, bot, event, state, stack, dependency_cache) File "D:\Python39\lib\site-packages\nonebot\message.py", line 202, in run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "D:\Python39\lib\site-packages\nonebot\internal\matcher.py", line 668, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "D:\Python39\lib\site-packages\nonebot\internal\matcher.py", line 635, in simple_run await handler( File "D:\Python39\lib\site-packages\nonebot\dependencies_init.py", line 92, in call return await self.call(**values) File "D:\QQBot\NoneBot\plugins\nonebot_plugin_admin\group_request.py", line 163, in gr status = await check_func_status("requests", str(gid)) File "D:\QQBot\NoneBot\plugins\nonebot_plugin_admin\utils.py", line 373, in check_func_status if funcs_status[gid][func_name]: KeyError: '群号'

    bug 
    opened by lakwsh 5
  • 自动禁言在关闭状态下还是会运行

    自动禁言在关闭状态下还是会运行

    描述 bug 救命啊,插件出现了自动禁言在关闭状态下还是会运行 问题

    如何复现

    1. 我通过 nb 方式安装并导入了插件
    2. 在 触发违禁词 时候 关闭 情况下,出现了 禁言 问题

    报错截图 (python的报错请截最下面) 这里放截图,可使用任何截图工具截图,然后在这里按下 ** Ctrl + V ** image image

    环境

    • 操作系统
    • Python 版本 3,9,13
    • Nonebot2 版本号 rc1
    • 在那里下载的本插件 nonebot商店
      • pypi (商店安装 或者 pip 安装(本质一样))
      • github ( 说明分支 ) main

    其他内容 ...

    bug 
    opened by zuixiaoxiao 3
  • [BUG]无法使用任何群管功能,能启用的只有开关状态

    [BUG]无法使用任何群管功能,能启用的只有开关状态

    描述 bug 无法使用任何群管功能,能启用的只有开关状态

    如何复现 每次监测说一句话就弹一个报错,下面那个数字每次都不一样 报错截图 (python的报错请截最下面) 这里放截图,可使用任何截图工具截图,然后在这里按下 ** Ctrl + V ** image

    环境

    • 操作系统 utunbu20.04
    • Python 版本 3.9.15
    • Nonebot2 版本号2.0.0b5
    • 在那里下载的本插件 nb商店
    • pypi (商店安装 或者 pip 安装(本质一样))pip
    • github ( 说明分支 ) main

    其他内容 ...

    bug Old Version 
    opened by Umamusume-Agnes-Digital 3
  • 无法适配rc1

    无法适配rc1

    描述 bug 救命啊,插件出现了版本 问题

    如何复现

    1. 我通过nb方式安装并导入了插件
    2. 在 启动时候 正常 情况下,出现了 无法加装 问题

    报错截图 (python的报错请截最下面) 这里放截图,可使用任何截图工具截图,然后在这里按下 ** Ctrl + V ** image image

    环境

    • 操作系统 win10
    • Python 版本 3.9.13
    • Nonebot2 版本号 rc1
    • 在那里下载的本插件
    • github ( 说明分支 )main

    其他内容 ...

    bug 
    opened by zuixiaoxiao 3
  • 出现报错

    出现报错

    08-25 10:50:33 [INFO] nonebot | Matcher <Matcher from src.plugins.nonebot_plugin_admin.auto_ban, type=message, priority=2, temp=False> running complete
    08-25 10:50:33 [ERROR] nonebot | Running matcher <Matcher from src.plugins.nonebot_plugin_admin.auto_ban, type=message, priority=2, temp=False> failed.
    Traceback (most recent call last):
    File "/usr/local/bin/nb", line 8, in <module>
    sys.exit(main())
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
    File "/usr/local/lib/python3.9/site-packages/nb_cli/commands/main.py", line 30, in run
    run_bot(file, app)
    File "/usr/local/lib/python3.9/site-packages/nb_cli/handlers/deploy.py", line 25, in run_bot
    nonebot.run(app=f"{module_name}:{app}")
    File "/usr/local/lib/python3.9/site-packages/nonebot/__init__.py", line 261, in run
    get_driver().run(*args, **kwargs)
    File "/usr/local/lib/python3.9/site-packages/nonebot/drivers/fastapi.py", line 170, in run
    uvicorn.run(
    File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 575, in run
    server.run()
    File "/usr/local/lib/python3.9/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
    File "/usr/lib64/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
    File "/usr/local/lib/python3.9/site-packages/nonebot/message.py", line 146, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
    > File "/usr/local/lib/python3.9/site-packages/nonebot/message.py", line 196, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
    File "/usr/local/lib/python3.9/site-packages/nonebot/internal/matcher.py", line 672, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
    File "/usr/local/lib/python3.9/site-packages/nonebot/internal/matcher.py", line 639, in simple_run
    await handler(
    File "/usr/local/lib/python3.9/site-packages/nonebot/dependencies/__init__.py", line 92, in __call__
    return await self.call(**values)
    File "/opt/jamyidobot/./src/plugins/nonebot_plugin_admin/auto_ban.py", line 35, in _
    if rule[0] and re.search(rule[0], msg): # TODO: 分群配置
    File "/usr/lib64/python3.9/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
    File "/usr/lib64/python3.9/re.py", line 304, in _compile
    p = sre_compile.compile(pattern, flags)
    File "/usr/lib64/python3.9/sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
    File "/usr/lib64/python3.9/sre_parse.py", line 948, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
    File "/usr/lib64/python3.9/sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
    File "/usr/lib64/python3.9/sre_parse.py", line 671, in _parse
    raise source.error("multiple repeat",
    re.error: multiple repeat at position 2
    

    是我的问题还是插件的问题😅

    duplicate 
    opened by HuYihe2008 3
  • [功能建议]建议添加一个菜单

    [功能建议]建议添加一个菜单

    暂且把这个功能命名为 : /指令 普通用户输入/ 指令可看到仅此身份下可执行的所有命令 (或者是出现所有的指令) 管理及以上 输入/指令 可以看到全部指令 或者可以提供一个菜单模板让SUPERUSER可以自定义菜单(推荐) ps: 群友啥都不知道,整合那么多插件的机器人没菜单,但都知道这玩意会禁言qwq

    产品经理 
    opened by Reversedeer 1
Releases(V0.4.2)
Owner
幼稚园园长
幼稚园园长
A QQ(Tencent) robot created by go-cqhttp & nonebot2

绘梨花(胶布)Bot|ErikaBot ✨ 基于NoneBot2的绘梨花多功能 Bot ,自用 ✨ 快速开始 参考go-cqhttp项目文档,配置好机器人的相关设置,以及反向ws客户端 参考nonebot2项目文档,添加必要的.env相关设置 安装本项目相关的依赖库(依赖清单) git clone本

null 10 Aug 9, 2022
A qq bot based on nonebot2 and go-cqhttp

Asoul-bot A qq bot based on nonebot and go-cqhttp 你可以将bot部署在本地,也可以加入bot测试群:784280070(全体禁言) 你可以通过临时会话的方式向bot发送指令,输入help获取帮助菜单 本地部署请参考:https://zhuanlan.

null 11 Sep 23, 2022
A nonebot2 plugin, send news information in a picture form.

A nonebot2 plugin, send news information in a picture form.

幼稚园园长 7 Nov 18, 2022
A QQ(Tencent) robot created by go-cqhttp & nonebot2

绘梨花(胶布)Bot|ErikaBot ✨ 基于NoneBot2的绘梨花多功能 Bot ,自用 ✨ 快速开始 参考go-cqhttp项目文档,配置好机器人的相关设置,以及反向ws客户端 参考nonebot2项目文档,添加必要的.env相关设置 安装本项目相关的依赖库(依赖清单) git clone本

null 10 Aug 9, 2022