Merge pull request #471 from nonebot/bugfix/mirai-tag-escape

Fix log tag escape error in `event.get_description` in mirai adapter
This commit is contained in:
Ju4tCode 2021-08-06 02:32:53 +08:00 committed by GitHub
commit 2fe01f33e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -227,7 +227,6 @@ class Bot(BaseBot):
@overrides(BaseBot)
async def handle_message(self, message: bytes):
Log.debug(f'received message {message}')
try:
await process_event(
bot=self,

View File

@ -9,6 +9,7 @@ from nonebot.adapters import Event as BaseEvent
from nonebot.adapters import Message as BaseMessage
from nonebot.log import logger
from nonebot.typing import overrides
from nonebot.utils import escape_tag
class UserPermission(str, Enum):
@ -88,7 +89,7 @@ class Event(BaseEvent):
@overrides(BaseEvent)
def get_type(self) -> Literal["message", "notice", "request", "meta_event"]:
from . import message, notice, request, meta
from . import message, meta, notice, request
if isinstance(self, message.MessageEvent):
return 'message'
elif isinstance(self, notice.NoticeEvent):
@ -104,7 +105,7 @@ class Event(BaseEvent):
@overrides(BaseEvent)
def get_event_description(self) -> str:
return str(self.normalize_dict())
return escape_tag(str(self.normalize_dict()))
@overrides(BaseEvent)
def get_message(self) -> BaseMessage: