Skip to content

Commit

Permalink
🚨 auto fix by pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jun 1, 2024
1 parent 2211b84 commit e1bec03
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
7 changes: 5 additions & 2 deletions nonebot_plugin_saa/types/common_message_segment.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from io import BytesIO
from pathlib import Path
from typing import Union, TypedDict, overload, Dict
from typing_extensions import NotRequired
from typing import Dict, Union, TypedDict, overload

from ..registries import MessageId
from ..abstract_factories import MessageFactory, MessageSegmentFactory
from ..utils import SupportedAdapters
from ..abstract_factories import MessageFactory, MessageSegmentFactory


class TextData(TypedDict):
text: str
Expand Down Expand Up @@ -118,6 +119,7 @@ class MentionAllData(TypedDict):
fallback: Union[str, None]
special_fallback: NotRequired[Dict[SupportedAdapters, str]]


class MentionAll(MessageSegmentFactory):
"""提到所有人"""

Expand Down Expand Up @@ -177,6 +179,7 @@ def set_special_fallback(self, adapter: SupportedAdapters, fallback: str):
self.data["special_fallback"] = {}
self.data["special_fallback"][adapter] = fallback


class ReplyData(TypedDict):
message_id: MessageId

Expand Down
6 changes: 4 additions & 2 deletions tests/test_dodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ async def test_mention_all(app: App, assert_dodo):
await assert_dodo(app, MentionAll(online_only=True), MessageSegment.text("@在线成员 "))
await assert_dodo(app, MentionAll("amiya"), MessageSegment.text("amiya"))
await assert_dodo(
app, MentionAll("@amiya", online_only=True), MessageSegment.text("@amiya"))
app, MentionAll("@amiya", online_only=True), MessageSegment.text("@amiya")
)
await assert_dodo(
app, MentionAll("amiya", online_only=True), MessageSegment.text("amiya"))
app, MentionAll("amiya", online_only=True), MessageSegment.text("amiya")
)

ma = MentionAll()
ma.set_special_fallback(SupportedAdapters.dodo, "amiya")
Expand Down
4 changes: 3 additions & 1 deletion tests/test_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ async def test_mention_all(app: App, assert_telegram: AssertTelegramFuncType):
await assert_telegram(app, MentionAll(), Entity.text("@everyone "))
await assert_telegram(app, MentionAll(online_only=True), Entity.text("@online "))
await assert_telegram(app, MentionAll("114514"), Entity.text("114514"))
await assert_telegram(app, MentionAll(fallback="@1919810", online_only=True), Entity.text("@1919810"))
await assert_telegram(
app, MentionAll(fallback="@1919810", online_only=True), Entity.text("@1919810")
)

ma = MentionAll()
ma.set_special_fallback(SupportedAdapters.telegram, "1919810")
Expand Down

0 comments on commit e1bec03

Please sign in to comment.