mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-12-01 01:25:07 +08:00
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:
commit
2fe01f33e0
@ -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,
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user