Skip to content

Commit ce14a0f

Browse files
committed
fix: add missing platform adapter filter types
1 parent c1cd562 commit ce14a0f

1 file changed

Lines changed: 15 additions & 18 deletions

File tree

astrbot/core/star/filter/platform_adapter_type.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class PlatformAdapterType(enum.Flag):
1010
AIOCQHTTP = enum.auto()
1111
QQOFFICIAL = enum.auto()
12+
QQOFFICIAL_WEBHOOK = enum.auto()
1213
TELEGRAM = enum.auto()
1314
WECOM = enum.auto()
1415
WECOM_AI_BOT = enum.auto()
@@ -23,29 +24,16 @@ class PlatformAdapterType(enum.Flag):
2324
MISSKEY = enum.auto()
2425
LINE = enum.auto()
2526
MATRIX = enum.auto()
26-
ALL = (
27-
AIOCQHTTP
28-
| QQOFFICIAL
29-
| TELEGRAM
30-
| WECOM
31-
| WECOM_AI_BOT
32-
| LARK
33-
| DINGTALK
34-
| DISCORD
35-
| SLACK
36-
| KOOK
37-
| VOCECHAT
38-
| WEIXIN_OFFICIAL_ACCOUNT
39-
| SATORI
40-
| MISSKEY
41-
| LINE
42-
| MATRIX
43-
)
27+
WEIXIN_OC = enum.auto()
28+
MATTERMOST = enum.auto()
29+
WEBCHAT = enum.auto()
30+
ALL = enum.auto()
4431

4532

4633
ADAPTER_NAME_2_TYPE = {
4734
"aiocqhttp": PlatformAdapterType.AIOCQHTTP,
4835
"qq_official": PlatformAdapterType.QQOFFICIAL,
36+
"qq_official_webhook": PlatformAdapterType.QQOFFICIAL_WEBHOOK,
4937
"telegram": PlatformAdapterType.TELEGRAM,
5038
"wecom": PlatformAdapterType.WECOM,
5139
"wecom_ai_bot": PlatformAdapterType.WECOM_AI_BOT,
@@ -60,6 +48,9 @@ class PlatformAdapterType(enum.Flag):
6048
"misskey": PlatformAdapterType.MISSKEY,
6149
"line": PlatformAdapterType.LINE,
6250
"matrix": PlatformAdapterType.MATRIX,
51+
"weixin_oc": PlatformAdapterType.WEIXIN_OC,
52+
"mattermost": PlatformAdapterType.MATTERMOST,
53+
"webchat": PlatformAdapterType.WEBCHAT,
6354
}
6455

6556

@@ -71,6 +62,12 @@ def __init__(self, platform_adapter_type_or_str: PlatformAdapterType | str) -> N
7162
self.platform_type = platform_adapter_type_or_str
7263

7364
def filter(self, event: AstrMessageEvent, cfg: AstrBotConfig) -> bool:
65+
if (
66+
self.platform_type is not None
67+
and self.platform_type & PlatformAdapterType.ALL
68+
):
69+
return True
70+
7471
adapter_name = event.get_platform_name()
7572
if adapter_name in ADAPTER_NAME_2_TYPE and self.platform_type is not None:
7673
return bool(ADAPTER_NAME_2_TYPE[adapter_name] & self.platform_type)

0 commit comments

Comments
 (0)