Skip to content

Commit

Permalink
🎨 fix version 0.11.1
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Apr 26, 2024
1 parent 83f41e8 commit 856142a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions nonebot/adapters/satori/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from nonebot.message import handle_event
from nonebot.drivers import Request, Response
from nonebot.compat import type_validate_python, model_dump
from nonebot.compat import model_dump, type_validate_python

from nonebot.adapters import Bot as BaseBot

Expand All @@ -15,7 +15,7 @@
from .event import Event, MessageEvent
from .models import InnerMessage as SatoriMessage
from .message import Author, Message, RenderMessage, MessageSegment
from .models import Role, User, Guild, Login, Channel, PageResult, Member
from .models import Role, User, Guild, Login, Member, Channel, PageResult
from .exception import (
ActionFailed,
NetworkError,
Expand Down
16 changes: 7 additions & 9 deletions nonebot/adapters/satori/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,31 @@


if PYDANTIC_V2:
from pydantic import model_validator as model_validator
from pydantic import field_validator as field_validator
from pydantic import model_validator as model_validator
else:
from pydantic import root_validator, validator
from pydantic import validator, root_validator

@overload
def field_validator(
__field: str,
*fields: str,
mode: Literal['before'],
mode: Literal["before"],
check_fields: Optional[bool] = None,
):
...
): ...

@overload
def field_validator(
__field: str,
*fields: str,
mode: Literal['after'],
mode: Literal["after"],
check_fields: Optional[bool] = None,
):
...
): ...

def field_validator(
__field: str,
*fields: str,
mode: Literal['before', 'after'],
mode: Literal["before", "after"],
check_fields: Optional[bool] = None,
):
if mode == "before":
Expand Down
2 changes: 1 addition & 1 deletion nonebot/adapters/satori/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from .message import Message, RenderMessage
from .models import InnerMessage as SatoriMessage
from .models import ArgvInteraction, ButtonInteraction
from .models import Guild, Login, Channel, ChannelType, Member
from .models import Guild, Login, Member, Channel, ChannelType

E = TypeVar("E", bound="Event")

Expand Down
2 changes: 1 addition & 1 deletion nonebot/adapters/satori/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from nonebot.compat import PYDANTIC_V2, ConfigDict

from .utils import log
from .compat import model_validator, field_validator
from .compat import field_validator, model_validator


class ChannelType(IntEnum):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def test_message_fallback():
</video>
"""
msg = Message.from_satori_element(parse(code))
assert str(msg[0].children) == '当前平台不支持发送视频,请在<a href="http://aa.com/a.mp4">这里</a>观看视频!'
assert (
str(msg[0].children) == '当前平台不支持发送视频,请在<a href="http://aa.com/a.mp4">这里</a>观看视频!'
)
assert msg.extract_plain_text() == "当前平台不支持发送视频,请在这里观看视频!"
assert list(msg.query("link"))[0].data["text"] == "http://aa.com/a.mp4"

0 comments on commit 856142a

Please sign in to comment.