diff --git a/none/__init__.py b/none/__init__.py index d6fc779e..d63f004f 100644 --- a/none/__init__.py +++ b/none/__init__.py @@ -143,10 +143,8 @@ def load_builtin_plugins() -> None: load_plugins(plugin_dir, 'none.plugins') -from .message import message_preprocessor +from .message import message_preprocessor, Message, MessageSegment from .command import on_command, CommandSession, CommandGroup from .natural_language import on_natural_language, NLPSession, NLPResult -from .notice_request import ( - on_notice, NoticeSession, - on_request, RequestSession, -) +from .notice_request import (on_notice, NoticeSession, + on_request, RequestSession) diff --git a/none/expression.py b/none/expression.py index 037a41eb..97a7f7c2 100644 --- a/none/expression.py +++ b/none/expression.py @@ -1,7 +1,7 @@ import random from typing import Union, Sequence, Callable -from aiocqhttp import message +from .message import escape Expression_T = Union[str, Sequence[str], Callable] @@ -23,5 +23,5 @@ def render(expr: Expression_T, *, escape_args=True, if escape_args: for k, v in kwargs.items(): if isinstance(v, str): - kwargs[k] = message.escape(v) + kwargs[k] = escape(v) return expr.format(**kwargs) diff --git a/none/natural_language.py b/none/natural_language.py index b5f768ae..5a54d60b 100644 --- a/none/natural_language.py +++ b/none/natural_language.py @@ -3,11 +3,10 @@ import re from collections import namedtuple from typing import Dict, Any, Iterable, Optional, Callable, Union -from aiocqhttp.message import Message - from . import NoneBot, permission as perm from .command import call_command from .log import logger +from .message import Message from .session import BaseSession _nl_processors = set() diff --git a/none/plugins/base.py b/none/plugins/base.py index 0347e3e0..7ef4b6ad 100644 --- a/none/plugins/base.py +++ b/none/plugins/base.py @@ -1,6 +1,5 @@ -from aiocqhttp.message import unescape - from none import on_command, CommandSession, permission as perm +from none.message import unescape @on_command('echo')