2022-01-18 23:46:10 +08:00
|
|
|
"""本模块包含了 NoneBot 事件处理过程中使用到的常量。
|
|
|
|
|
2022-01-16 11:30:09 +08:00
|
|
|
FrontMatter:
|
2024-10-22 10:33:48 +08:00
|
|
|
mdx:
|
|
|
|
format: md
|
2022-01-16 11:30:09 +08:00
|
|
|
sidebar_position: 9
|
|
|
|
description: nonebot.consts 模块
|
|
|
|
"""
|
2023-06-24 14:47:35 +08:00
|
|
|
|
2023-03-24 11:47:02 +08:00
|
|
|
import os
|
|
|
|
import sys
|
2022-08-14 19:41:00 +08:00
|
|
|
from typing import Literal
|
2022-01-16 11:30:09 +08:00
|
|
|
|
2021-12-14 01:08:48 +08:00
|
|
|
# used by Matcher
|
2022-01-16 11:30:09 +08:00
|
|
|
RECEIVE_KEY: Literal["_receive_{id}"] = "_receive_{id}"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""`receive` 存储 key"""
|
2022-01-16 11:30:09 +08:00
|
|
|
LAST_RECEIVE_KEY: Literal["_last_receive"] = "_last_receive"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""`last_receive` 存储 key"""
|
2022-01-16 11:30:09 +08:00
|
|
|
ARG_KEY: Literal["{key}"] = "{key}"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""`arg` 存储 key"""
|
2022-01-16 11:30:09 +08:00
|
|
|
REJECT_TARGET: Literal["_current_target"] = "_current_target"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""当前 `reject` 目标存储 key"""
|
2022-01-16 11:30:09 +08:00
|
|
|
REJECT_CACHE_TARGET: Literal["_next_target"] = "_next_target"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""下一个 `reject` 目标存储 key"""
|
2021-12-14 01:08:48 +08:00
|
|
|
|
|
|
|
# used by Rule
|
2022-01-16 11:30:09 +08:00
|
|
|
PREFIX_KEY: Literal["_prefix"] = "_prefix"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""命令前缀存储 key"""
|
2021-12-14 01:08:48 +08:00
|
|
|
|
2022-01-16 11:30:09 +08:00
|
|
|
CMD_KEY: Literal["command"] = "command"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""命令元组存储 key"""
|
2022-01-16 11:30:09 +08:00
|
|
|
RAW_CMD_KEY: Literal["raw_command"] = "raw_command"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""命令文本存储 key"""
|
2022-01-16 11:30:09 +08:00
|
|
|
CMD_ARG_KEY: Literal["command_arg"] = "command_arg"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""命令参数存储 key"""
|
2022-04-20 14:43:29 +08:00
|
|
|
CMD_START_KEY: Literal["command_start"] = "command_start"
|
|
|
|
"""命令开头存储 key"""
|
2023-02-27 00:11:24 +08:00
|
|
|
CMD_WHITESPACE_KEY: Literal["command_whitespace"] = "command_whitespace"
|
|
|
|
"""命令与参数间空白符存储 key"""
|
2021-12-14 01:08:48 +08:00
|
|
|
|
2022-01-16 11:30:09 +08:00
|
|
|
SHELL_ARGS: Literal["_args"] = "_args"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""shell 命令 parse 后参数字典存储 key"""
|
2022-01-16 11:30:09 +08:00
|
|
|
SHELL_ARGV: Literal["_argv"] = "_argv"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""shell 命令原始参数列表存储 key"""
|
2021-12-14 01:08:48 +08:00
|
|
|
|
2022-01-16 11:30:09 +08:00
|
|
|
REGEX_MATCHED: Literal["_matched"] = "_matched"
|
2022-01-18 16:12:12 +08:00
|
|
|
"""正则匹配结果存储 key"""
|
2022-10-12 13:41:28 +08:00
|
|
|
STARTSWITH_KEY: Literal["_startswith"] = "_startswith"
|
|
|
|
"""响应触发前缀 key"""
|
|
|
|
ENDSWITH_KEY: Literal["_endswith"] = "_endswith"
|
|
|
|
"""响应触发后缀 key"""
|
|
|
|
FULLMATCH_KEY: Literal["_fullmatch"] = "_fullmatch"
|
|
|
|
"""响应触发完整消息 key"""
|
|
|
|
KEYWORD_KEY: Literal["_keyword"] = "_keyword"
|
|
|
|
"""响应触发关键字 key"""
|
2023-03-24 11:47:02 +08:00
|
|
|
|
|
|
|
WINDOWS = sys.platform.startswith("win") or (sys.platform == "cli" and os.name == "nt")
|