mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-28 05:59:10 +08:00
🐛 Fix log tag escape error in event.get_description
This commit is contained in:
parent
8e97a84ad8
commit
410266acb1
@ -227,7 +227,6 @@ class Bot(BaseBot):
|
|||||||
|
|
||||||
@overrides(BaseBot)
|
@overrides(BaseBot)
|
||||||
async def handle_message(self, message: bytes):
|
async def handle_message(self, message: bytes):
|
||||||
Log.debug(f'received message {message}')
|
|
||||||
try:
|
try:
|
||||||
await process_event(
|
await process_event(
|
||||||
bot=self,
|
bot=self,
|
||||||
|
@ -9,6 +9,7 @@ from nonebot.adapters import Event as BaseEvent
|
|||||||
from nonebot.adapters import Message as BaseMessage
|
from nonebot.adapters import Message as BaseMessage
|
||||||
from nonebot.log import logger
|
from nonebot.log import logger
|
||||||
from nonebot.typing import overrides
|
from nonebot.typing import overrides
|
||||||
|
from nonebot.utils import escape_tag
|
||||||
|
|
||||||
|
|
||||||
class UserPermission(str, Enum):
|
class UserPermission(str, Enum):
|
||||||
@ -88,7 +89,7 @@ class Event(BaseEvent):
|
|||||||
|
|
||||||
@overrides(BaseEvent)
|
@overrides(BaseEvent)
|
||||||
def get_type(self) -> Literal["message", "notice", "request", "meta_event"]:
|
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):
|
if isinstance(self, message.MessageEvent):
|
||||||
return 'message'
|
return 'message'
|
||||||
elif isinstance(self, notice.NoticeEvent):
|
elif isinstance(self, notice.NoticeEvent):
|
||||||
@ -104,7 +105,7 @@ class Event(BaseEvent):
|
|||||||
|
|
||||||
@overrides(BaseEvent)
|
@overrides(BaseEvent)
|
||||||
def get_event_description(self) -> str:
|
def get_event_description(self) -> str:
|
||||||
return str(self.normalize_dict())
|
return escape_tag(str(self.normalize_dict()))
|
||||||
|
|
||||||
@overrides(BaseEvent)
|
@overrides(BaseEvent)
|
||||||
def get_message(self) -> BaseMessage:
|
def get_message(self) -> BaseMessage:
|
||||||
|
Loading…
Reference in New Issue
Block a user