diff --git a/nonebot/consts.py b/nonebot/consts.py index 11e3feaa..5f6fa52b 100644 --- a/nonebot/consts.py +++ b/nonebot/consts.py @@ -1,20 +1,22 @@ +from sys import intern + # used by Matcher -RECEIVE_KEY = "_receive_{id}" -LAST_RECEIVE_KEY = "_last_receive" -ARG_KEY = "{key}" -REJECT_TARGET = "_current_target" -REJECT_CACHE_TARGET = "_next_target" +RECEIVE_KEY = intern("_receive_{id}") +LAST_RECEIVE_KEY = intern("_last_receive") +ARG_KEY = intern("{key}") +REJECT_TARGET = intern("_current_target") +REJECT_CACHE_TARGET = intern("_next_target") # used by Rule -PREFIX_KEY = "_prefix" +PREFIX_KEY = intern("_prefix") -CMD_KEY = "command" -RAW_CMD_KEY = "raw_command" -CMD_ARG_KEY = "command_arg" +CMD_KEY = intern("command") +RAW_CMD_KEY = intern("raw_command") +CMD_ARG_KEY = intern("command_arg") -SHELL_ARGS = "_args" -SHELL_ARGV = "_argv" +SHELL_ARGS = intern("_args") +SHELL_ARGV = intern("_argv") -REGEX_MATCHED = "_matched" -REGEX_GROUP = "_matched_groups" -REGEX_DICT = "_matched_dict" +REGEX_MATCHED = intern("_matched") +REGEX_GROUP = intern("_matched_groups") +REGEX_DICT = intern("_matched_dict")