-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
适配 satori 适配器 #118
适配 satori 适配器 #118
Conversation
✅ Deploy Preview for send-anything-anywhere ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
- Coverage 95.67% 95.41% -0.27%
==========================================
Files 25 26 +1
Lines 1874 2070 +196
==========================================
+ Hits 1793 1975 +182
- Misses 81 95 +14 ☔ View full report in Codecov by Sentry. |
该更新了( |
211b572
to
2e0a567
Compare
更新了喵 不过还是没有写测试(实测是能用的 |
@register_target_extractor(PrivateMessageEvent) | ||
def _extract_private_msg_event(event: Event) -> PlatformTarget: | ||
assert isinstance(event, PrivateMessageEvent) | ||
if event.platform in ["qq", "red", "chronocat"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里能用 const name 吗
@register_target_extractor(PublicMessageEvent) | ||
def _extract_group_msg_event(event: Event) -> PlatformTarget: | ||
assert isinstance(event, PublicMessageEvent) | ||
if event.platform in ["qq", "red", "chronocat"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
else: | ||
await bot.send_message(message=message_to_send, **target.arg_dict(bot)) | ||
|
||
class PagedAPI(Generic[T], Protocol): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个能直接写成一个 type alias 吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我记得之前问过,这种泛型只有 Protocol 才支持。
https://peps.python.org/pep-0544/#callback-protocols
@@ -44,6 +45,16 @@ | |||
register_target_extractor, | |||
) | |||
|
|||
|
|||
class SatoriPlatform(str, Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是写在 satori 的接口定义里的?
No description provided.