Skip to content

Commit b38e1f0

Browse files
committed
✨ add adapter EFChat
1 parent 7fc39ea commit b38e1f0

File tree

8 files changed

+205
-27
lines changed

8 files changed

+205
-27
lines changed

README.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ async def _():
9797
| [Mail](https://github.com/mobyw/nonebot-adapter-mail) | adapters.mail |
9898
| [微信公众号](https://github.com/YangRucheng/nonebot-adapter-wxmp) | adapters.wxmp |
9999
| [黑盒语音](https://github.com/lclbm/adapter-heybox) | adapters.heybox |
100-
| [Gewechat](https://github.com/Shine-Light/nonebot-adapter-gewechat) | adapters.gewechat |
101100
| [Milky](https://github.com/nonebot/adapter-milky) | adapters.milky |
101+
| [EFChat](https://github.com/molanp/nonebot_adapter_efchat) | adapters.efchat |
102+
102103

103104
### 支持的消息元素
104105

@@ -113,25 +114,25 @@ async def _():
113114
> [!WARNING]
114115
> 斜体的协议名称意味着其协议或其适配器长时间未维护或已失效
115116
116-
| 元素\适配器 | OneBot V11 | OneBot V12 | Telegram | 飞书 | Github | QQ-API | _钉钉_ | Console | 开黑啦 | Mirai | _Ntchat_ | MineCraft | Discord | _Red_ | Satori | Dodo IM | _Kritor_ | Tailchat | Mail | 微信公众号 | 黑盒语音 | _Gewechat_ | Milky |
117-
|------------------|------------|------------|----------|----|--------|--------|------|---------|-----|-------|----------|-----------|---------|-------|--------|---------|----------|----------|------|-------|------|------------|-------|
118-
| 文本 Text |||||||||||||||||||||| ||
119-
| 样式文本 Styled Text | 🚫 | 🚫 |||||||| 🚫 | 🚫 || 🚫 | 🚫 || 🚫 | 🚫 ||| 🚫 | 🚫 | 🚫 | 🚫 |
120-
| 提及用户 At(user) ||||| ⬆️ ||| 🚫 |||| 🚫 ||||||| ⬆️ | 🚫 | ⬆️ | ||
121-
| 提及角色 At(role) | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 || 🚫 ||| 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
122-
| 提及频道 At(channel) | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 || 🚫 | 🚫 || 🚫 | 🚫 | 🚫 || 🚫 ||| 🚫 || ⬆️ | 🚫 | 🚫 | 🚫 | 🚫 |
123-
| 提交全体 AtAll ||| 🚫 || 🚫 ||| 🚫 ||| 🚫 | 🚫 |||||| 🚫 | 🚫 | 🚫 | 🚫 | | |
124-
| 表情 Emoji || 🚫 || 🚫 | 🚫 || 🚫 |||| 🚫 | 🚫 ||| 🚫 | 🚫 ||| 🚫 || 🚫 | | |
125-
| 图片 Image ||||| ⬆️ ||| 🚫 ||||||||||||| ⬆️ | ||
126-
| 音频 Audio | ⬆️ |||| 🚫 || 🚫 | 🚫 || ⬆️ | ⬇️ | 🚫 | ⬆️ | ⬆️ || 🚫 | ⬆️ | 🚫 ||| 🚫 | | ⬆️ |
127-
| 语音 Voice |||| ⬆️ | 🚫 | ⬆️ | 🚫 | 🚫 | ⬆️ || ⬇️ | 🚫 | ⬆️ || ⬆️ | 🚫 || 🚫 ||| 🚫 | ||
128-
| 视频 Video ||||| 🚫 || 🚫 | 🚫 |||| 🚫 | ⬆️ ||||| 🚫 ||| 🚫 | | |
129-
| 文件 File | ⬇️,⬆️(🚧) |||| 🚫 || 🚫 | 🚫 |||| 🚫 | ⬆️ ||| ⬇️ | ⬇️ ||| 🚫 | 🚫 | | ⬆️ |
130-
| 回复 Reply ||||| 🚫 || 🚫 | 🚫 |||| 🚫 |||||||| 🚫 | ⬆️ | | |
131-
| 引用转发 Reference || 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 ||| 🚫 || 🚫 | 🚫 | 🚫 | 🚫 | | |
132-
| 超级消息 Hyper || 🚫 | 🚫 | ⬇️ | 🚫 || 🚫 | 🚫 |||| 🚫 | 🚫 || 🚫 | 🚫 || 🚫 | 🚫 || 🚫 | | ⬇️ |
133-
| 按钮 Button | 🚫 | 🚫 | ⬆️ | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | ⬆️ || 🚫 || 🚫 || 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
134-
| 其余 Other |||||||||||||||||||||| | |
117+
| 元素\适配器 | OneBot V11 | OneBot V12 | Telegram | 飞书 | Github | QQ-API | _钉钉_ | Console | 开黑啦 | Mirai | _Ntchat_ | MineCraft | Discord | _Red_ | Satori | Dodo IM | _Kritor_ | Tailchat | Mail | 微信公众号 | 黑盒语音 | Milky | EFChat |
118+
|------------------|------------|------------|----------|----|--------|--------|------|---------|-----|-------|----------|-----------|---------|-------|--------|---------|----------|----------|------|-------|------|-------|--------|
119+
| 文本 Text ||||||||||||||||||||||| |
120+
| 样式文本 Styled Text | 🚫 | 🚫 |||||||| 🚫 | 🚫 || 🚫 | 🚫 || 🚫 | 🚫 ||| 🚫 | 🚫 | 🚫 | |
121+
| 提及用户 At(user) ||||| ⬆️ ||| 🚫 |||| 🚫 ||||||| ⬆️ | 🚫 | ⬆️ || |
122+
| 提及角色 At(role) | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 || 🚫 ||| 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
123+
| 提及频道 At(channel) | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 || 🚫 | 🚫 || 🚫 | 🚫 | 🚫 || 🚫 ||| 🚫 || ⬆️ | 🚫 | 🚫 | 🚫 | 🚫 |
124+
| 提交全体 AtAll ||| 🚫 || 🚫 ||| 🚫 ||| 🚫 | 🚫 |||||| 🚫 | 🚫 | 🚫 | 🚫 || 🚫 |
125+
| 表情 Emoji || 🚫 || 🚫 | 🚫 || 🚫 |||| 🚫 | 🚫 ||| 🚫 | 🚫 ||| 🚫 || 🚫 || 🚫 |
126+
| 图片 Image ||||| ⬆️ ||| 🚫 ||||||||||||| ⬆️ || |
127+
| 音频 Audio | ⬆️ |||| 🚫 || 🚫 | 🚫 || ⬆️ | ⬇️ | 🚫 | ⬆️ | ⬆️ || 🚫 | ⬆️ | 🚫 ||| 🚫 | ⬆️ | ⬆️ |
128+
| 语音 Voice |||| ⬆️ | 🚫 | ⬆️ | 🚫 | 🚫 | ⬆️ || ⬇️ | 🚫 | ⬆️ || ⬆️ | 🚫 || 🚫 ||| 🚫 | | |
129+
| 视频 Video ||||| 🚫 || 🚫 | 🚫 |||| 🚫 | ⬆️ ||||| 🚫 ||| 🚫 | | 🚫 |
130+
| 文件 File | ⬇️,⬆️(🚧) |||| 🚫 || 🚫 | 🚫 |||| 🚫 | ⬆️ ||| ⬇️ | ⬇️ ||| 🚫 | 🚫 | ⬆️ | 🚫 |
131+
| 回复 Reply ||||| 🚫 || 🚫 | 🚫 |||| 🚫 |||||||| 🚫 | ⬆️ || ⬆️ |
132+
| 引用转发 Reference || 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 ||| 🚫 || 🚫 | 🚫 | 🚫 | 🚫 | | 🚫 |
133+
| 超级消息 Hyper || 🚫 | 🚫 | ⬇️ | 🚫 || 🚫 | 🚫 |||| 🚫 | 🚫 || 🚫 | 🚫 || 🚫 | 🚫 || 🚫 | ⬇️ | 🚫 |
134+
| 按钮 Button | 🚫 | 🚫 | ⬆️ | 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | ⬆️ || 🚫 || 🚫 || 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
135+
| 其余 Other ||||||||||||||||||||||| |
135136

136137

137138
### 支持的消息操作
@@ -144,12 +145,12 @@ async def _():
144145
> [!WARNING]
145146
> 斜体的协议名称意味着其协议或其适配器长时间未维护或已失效
146147
147-
| 操作\适配器 | OneBot V11 | OneBot V12 | Telegram | 飞书 | Github | QQ-API | _钉钉_ | Console | 开黑啦 | Mirai | _Ntchat_ | MineCraft | Discord | _Red_ | Satori | Dodo IM | _Kritor_ | Tailchat | Mail | 微信公众号 | 黑盒语音 | _Gewechat_ | Milky |
148-
|---------------|------------|------------|----------|----|--------|--------|------|---------|-----|-------|----------|-----------|---------|-------|--------|---------|----------|----------|------|-------|------|------------|-------|
149-
| 发送 Send |||||||||||||||||||||| ||
150-
| 撤回 Recall |||||||| 🚫 |||| 🚫 ||||||| 🚫 | 🚫 | 🚫 | | |
151-
| 编辑 Edit | 🚫 | 🚫 |||| 🚫 || 🚫 || 🚫 | 🚫 | 🚫 || 🚫 ||| 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | 🚫 |
152-
| 表情响应 Reaction | ✅(🚧) | 🚫 ||||| 🚫 | 🚫 || 🚫 | 🚫 | 🚫 || 🚫 ||||| 🚫 | 🚫 | 🚫 | 🚫 | |
148+
| 操作\适配器 | OneBot V11 | OneBot V12 | Telegram | 飞书 | Github | QQ-API | _钉钉_ | Console | 开黑啦 | Mirai | _Ntchat_ | MineCraft | Discord | _Red_ | Satori | Dodo IM | _Kritor_ | Tailchat | Mail | 微信公众号 | 黑盒语音 | Milky | EFChat |
149+
|---------------|------------|------------|----------|----|--------|--------|------|---------|-----|-------|----------|-----------|---------|-------|--------|---------|----------|----------|------|-------|------|-------|--------|
150+
| 发送 Send ||||||||||||||||||||||| |
151+
| 撤回 Recall |||||||| 🚫 |||| 🚫 ||||||| 🚫 | 🚫 | 🚫 || 🚫 |
152+
| 编辑 Edit | 🚫 | 🚫 |||| 🚫 || 🚫 || 🚫 | 🚫 | 🚫 || 🚫 ||| 🚫 | 🚫 || 🚫 | 🚫 | 🚫 | 🚫 |
153+
| 表情响应 Reaction | ✅(🚧) | 🚫 ||||| 🚫 | 🚫 || 🚫 | 🚫 | 🚫 || 🚫 ||||| 🚫 | 🚫 | 🚫 | | 🚫 |
153154

154155

155156
## 配置项

pdm.lock

Lines changed: 27 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ dev = [
7272
"fix-future-annotations>=0.5.0",
7373
# "nonebot-adapter-heybox>=0.1.1; python_version >= \"3.11\"",
7474
"nonebot-adapter-milky>=0.4.0",
75+
"nonebot-adapter-efchat>=0.1.4",
7576
]
7677
test = [
7778
"nonebug>=0.4.3",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from nonebot_plugin_alconna.uniseg.loader import BaseLoader
2+
from nonebot_plugin_alconna.uniseg.constraint import SupportAdapter
3+
4+
5+
class Loader(BaseLoader):
6+
def get_adapter(self) -> SupportAdapter:
7+
return SupportAdapter.efchat
8+
9+
def get_builder(self):
10+
from .builder import EFChatMessageBuilder
11+
12+
return EFChatMessageBuilder()
13+
14+
def get_exporter(self):
15+
from .exporter import EFChatMessageExporter
16+
17+
return EFChatMessageExporter()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from nonebot.adapters.efchat.message import At as AtSegment
2+
from nonebot.adapters.efchat.message import Image as ImageSegment
3+
from nonebot.adapters.efchat.message import Voice as VoiceSegment
4+
5+
from nonebot_plugin_alconna.uniseg.segment import At, Image, Voice
6+
from nonebot_plugin_alconna.uniseg.constraint import SupportAdapter
7+
from nonebot_plugin_alconna.uniseg.builder import MessageBuilder, build
8+
9+
10+
class EFChatMessageBuilder(MessageBuilder):
11+
@classmethod
12+
def get_adapter(cls) -> SupportAdapter:
13+
return SupportAdapter.efchat
14+
15+
@build("at")
16+
def at(self, seg: AtSegment):
17+
return At("user", seg.data["target"])
18+
19+
@build("image")
20+
def image(self, seg: ImageSegment):
21+
return Image(url=seg.data["url"])
22+
23+
@build("voice")
24+
def voice(self, seg: VoiceSegment):
25+
return Voice(url=seg.data["url"], id=seg.data.get("src"))

0 commit comments

Comments
 (0)