Skip to content
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

Merged
merged 17 commits into from
Apr 8, 2024
Merged

适配 satori 适配器 #118

merged 17 commits into from
Apr 8, 2024

Conversation

he0119
Copy link
Contributor

@he0119 he0119 commented Nov 17, 2023

No description provided.

Copy link

netlify bot commented Nov 17, 2023

Deploy Preview for send-anything-anywhere ready!

Name Link
🔨 Latest commit cf4fe32
🔍 Latest deploy log https://app.netlify.com/sites/send-anything-anywhere/deploys/66058f1e0d4b8a0008b7ada4
😎 Deploy Preview https://deploy-preview-118--send-anything-anywhere.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Dec 2, 2023

Codecov Report

Attention: Patch coverage is 92.85714% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 95.41%. Comparing base (a381416) to head (cf4fe32).
Report is 1 commits behind head on main.

Files Patch % Lines
nonebot_plugin_saa/adapters/satori.py 92.43% 14 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@RF-Tar-Railt
Copy link

该更新了(

@AzideCupric
Copy link
Contributor

AzideCupric commented Mar 25, 2024

更新了喵 不过还是没有写测试(实测是能用的

@he0119 he0119 marked this pull request as ready for review March 26, 2024 08:40
@register_target_extractor(PrivateMessageEvent)
def _extract_private_msg_event(event: Event) -> PlatformTarget:
assert isinstance(event, PrivateMessageEvent)
if event.platform in ["qq", "red", "chronocat"]:
Copy link
Collaborator

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"]:
Copy link
Collaborator

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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个能直接写成一个 type alias 吗

Copy link
Contributor Author

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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是写在 satori 的接口定义里的?

@felinae98 felinae98 added the enhancement New feature or request label Apr 8, 2024
@felinae98 felinae98 changed the title ✨ 适配 satori 适配器 适配 satori 适配器 Apr 8, 2024
@felinae98 felinae98 merged commit d83d3cd into main Apr 8, 2024
20 checks passed
@felinae98 felinae98 deleted the feat/satori branch April 8, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants