on_message: 创建消息事件响应器。 on_request: 创建请求事件响应器。 on_notice: 创建通知事件响应器。 on_startswith: 创建消息开头匹配事件响应器。 on_endswith: 创建消息结尾匹配事件响应器。 on_fullmatch: 创建消息完全匹配事件响应器。 on_keyword: 创建消息关键词匹配事件响应器。
fromnonebotimporton_command fromnonebot.paramsimportDepends# 1.引用 Depends fromnonebot.adapters.onebot.v11importMessageEvent test = on_command("123") asyncdefdepend(event: MessageEvent):# 2.编写依赖函数 return{"uid": event.get_user_id(),"nickname": event.sender.nickname} @test.handle() async...
from nonebot import on_message message = on_message() 对于任何消息都会引发异常 01-01 14:57:55 [DEBUG] nonebot | CQHTTP | Event Parser Error Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\...\AppData\Local\Programs\Python\Python38\lib\mult...
操作系统 Linux Python 版本 3.12 NoneBot 版本 2.3.2 适配器 无关 协议端 无关 描述问题 Pylance严格模式下类型错误: Type of "on_message" is partially unknown Type of "get_message" is partially unknown Type of "send" is partially unknown 复现步骤 在vscode 中添
GroupMessageEvent:群消息(通过该类的属性获取到 群QQ号) finish()函数:发送一条消息给当前交互用户并结束当前事件响应器 __init__.py 文件 在该文件中编写各类事件响应及处理逻辑 fromnonebotimporton_command,export fromnonebot.typingimportT_State fromnonebot.adapters.cqhttpimportBot,Message,GroupMessageEvent,Gr...
fromnonebot.pluginimporton_command,export fromnonebot.adapters.cqhttpimportBot,Event fromnonebot.adapters.cqhttp.messageimportMessage export=export() export.name='今日人品' export.usage='''/jrrp''' defluck_simple(num): ifnum<18: return'大吉' ...
Demo= on_command('weather', rule=to_me(), aliases={"天气情况","天气预报"}) @Demo.handle() asyncdeftest_handle(matcher: Matcher, args: Message=CommandArg()): plain_text=args.extract_plain_text()ifplain_text: matcher.set_arg("city", args) ...
importnonebotfromnonebot.ruleimport*fromnonebotimporton_commandfromnonebotimport*fromnonebot.adapters.onebot.v11importBot, Event, MessageEvent, GroupMessageEventfromnonebot.adapters.onebot.v11.messageimportMessageimportPILfromPILimportImage, ImageDraw, ImageFontasyncdefhandle_rule(bot: Bot, event: Event) ->...
跨平台 Python 异步聊天机器人框架 / Asynchronous multi-platform chatbot framework written in Python - nonebot2/nonebot/plugin/on.py at 3d5dd5969cf6d057d0b3c2f201c2a5bb8243ac06 · nonebot/nonebot2
@@ -43,7 +43,7 @@ def on_message( rule: Rule | T_RuleChecker | None = ..., permission: Permission | T_PermissionChecker | None = ..., *, handlers: list[T_Handler | Dependent] | None = ..., handlers: list[T_Handler | Dependent[Any]] | None = ..., temp: bool = .....