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...
init.py文件 on_command:消息事件响应器 on_notice:通知事件响应器 export:获取插件的导出内容对象 fromnonebot.adapters.cqhttpimportBot,Event,PokeNotifyEvent fromnonebot.adapters.cqhttp.messageimportMessage fromnonebot.pluginimportexport,on_command,on_notice fromnonebot.ruleimportRule fromnonebot.typingimportT_St...
操作系统 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 中添
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'大吉' ...
同时撤回是通知事件,所以要用on_notice() 代码也挺短 importnonebotfromnonebot.ruleimport*fromnonebotimport*fromnonebot.pluginimporton_keywordfromnonebot.adapters.onebot.v11importBot, Event, GroupRecallNoticeEvent, FriendRecallNoticeEventfromnonebot.adapters.onebot.v11.messageimportMessageasyncdefhandle_rule(bot...
return on_message(keyword(*keywords) & rule, **kwargs)def on_command(cmd: Union[str, Tuple[str, ...]], rule: Optional[Union[Rule, RuleChecker]] = None, aliases: Optional[Set[Union[str, Tuple[str, ...]]] = None, **kwargs) -> Type[Matcher]: "...
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.pyi at 3d5dd5969cf6d057d0b3c2f201c2a5bb8243ac06 · nonebot/nonebot2