satori-python-adapter-qq 0.3.3__tar.gz → 0.4.0rc1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/.mina/adapter_qq.toml +1 -1
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/PKG-INFO +1 -1
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/pyproject.toml +1 -1
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/events/message.py +66 -2
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/message.py +4 -1
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/LICENSE +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/README.md +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/__init__.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/api.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/audit_store.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/events/__init__.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/events/base.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/events/group.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/events/guild.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/events/interaction.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/exception.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/main.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/utils.py +0 -0
- {satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/websocket.py +0 -0
|
@@ -82,6 +82,62 @@ async def direct_message_create(login, guild_login, net, payload: Payload):
|
|
|
82
82
|
)
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
@register_event("GROUP_MESSAGE_CREATE")
|
|
86
|
+
async def group_message_create(login, guild_login, net, payload: Payload):
|
|
87
|
+
raw = payload.data
|
|
88
|
+
if "group_openid" in raw:
|
|
89
|
+
channel = Channel(raw["group_openid"], ChannelType.TEXT)
|
|
90
|
+
else:
|
|
91
|
+
channel = Channel(raw["group_id"], ChannelType.TEXT)
|
|
92
|
+
app_id = net.bot_id_mapping[login.id]
|
|
93
|
+
name = raw["author"].get("username")
|
|
94
|
+
if "member_openid" in raw["author"]:
|
|
95
|
+
user = User(
|
|
96
|
+
raw["author"]["member_openid"],
|
|
97
|
+
name=name,
|
|
98
|
+
avatar=USER_AVATAR_URL.format(app_id=app_id, user_id=raw["author"]["member_openid"]),
|
|
99
|
+
is_bot=raw["author"].get("bot", False),
|
|
100
|
+
)
|
|
101
|
+
else:
|
|
102
|
+
user = User(
|
|
103
|
+
raw["author"]["id"],
|
|
104
|
+
name=name,
|
|
105
|
+
avatar=USER_AVATAR_URL.format(app_id=app_id, user_id=raw["author"]["id"]),
|
|
106
|
+
is_bot=raw["author"].get("bot", False),
|
|
107
|
+
)
|
|
108
|
+
member = Member(user, avatar=user.avatar)
|
|
109
|
+
msg = decode_segments(raw)
|
|
110
|
+
if msg and isinstance(elem := msg[0], At) and elem.id == "all" and isinstance(msg[1], Text):
|
|
111
|
+
text = msg[1].text.lstrip()
|
|
112
|
+
if not text:
|
|
113
|
+
msg.pop(1)
|
|
114
|
+
else:
|
|
115
|
+
msg[1] = Text(text)
|
|
116
|
+
for mention in reversed(raw["mentions"]):
|
|
117
|
+
if mention["scope"] == "all":
|
|
118
|
+
continue
|
|
119
|
+
msg.insert(0, At(mention["id"], name=mention.get("username")))
|
|
120
|
+
return Event(
|
|
121
|
+
EventType.MESSAGE_CREATED,
|
|
122
|
+
(
|
|
123
|
+
datetime.fromtimestamp(int(raw["timestamp"]))
|
|
124
|
+
if isinstance(raw["timestamp"], (int, float)) or raw["timestamp"].isdigit()
|
|
125
|
+
else datetime.fromisoformat(str(raw["timestamp"]))
|
|
126
|
+
),
|
|
127
|
+
login,
|
|
128
|
+
channel=channel,
|
|
129
|
+
guild=Guild(channel.id),
|
|
130
|
+
member=member,
|
|
131
|
+
user=user,
|
|
132
|
+
message=MessageObject.from_elements(raw["id"], msg),
|
|
133
|
+
referrer={
|
|
134
|
+
"msg_id": raw["id"],
|
|
135
|
+
"msg_seq": -1,
|
|
136
|
+
"msg_scene": raw["message_scene"],
|
|
137
|
+
},
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
|
|
85
141
|
@register_event("GROUP_AT_MESSAGE_CREATE")
|
|
86
142
|
async def group_at_message_create(login, guild_login, net, payload: Payload):
|
|
87
143
|
raw = payload.data
|
|
@@ -96,10 +152,14 @@ async def group_at_message_create(login, guild_login, net, payload: Payload):
|
|
|
96
152
|
raw["author"]["member_openid"],
|
|
97
153
|
name=name,
|
|
98
154
|
avatar=USER_AVATAR_URL.format(app_id=app_id, user_id=raw["author"]["member_openid"]),
|
|
155
|
+
is_bot=raw["author"].get("bot", False),
|
|
99
156
|
)
|
|
100
157
|
else:
|
|
101
158
|
user = User(
|
|
102
|
-
raw["author"]["id"],
|
|
159
|
+
raw["author"]["id"],
|
|
160
|
+
name=name,
|
|
161
|
+
avatar=USER_AVATAR_URL.format(app_id=app_id, user_id=raw["author"]["id"]),
|
|
162
|
+
is_bot=raw["author"].get("bot", False),
|
|
103
163
|
)
|
|
104
164
|
member = Member(user, avatar=user.avatar)
|
|
105
165
|
msg = decode_segments(raw)
|
|
@@ -141,10 +201,14 @@ async def c2c_message_create(login, guild_login, net, payload: Payload):
|
|
|
141
201
|
raw["author"]["user_openid"],
|
|
142
202
|
name,
|
|
143
203
|
avatar=USER_AVATAR_URL.format(app_id=app_id, user_id=raw["author"]["user_openid"]),
|
|
204
|
+
is_bot=raw["author"].get("bot"),
|
|
144
205
|
)
|
|
145
206
|
else:
|
|
146
207
|
user = User(
|
|
147
|
-
raw["author"]["id"],
|
|
208
|
+
raw["author"]["id"],
|
|
209
|
+
name,
|
|
210
|
+
avatar=USER_AVATAR_URL.format(app_id=app_id, user_id=raw["author"]["id"]),
|
|
211
|
+
is_bot=raw["author"].get("bot"),
|
|
148
212
|
)
|
|
149
213
|
channel = Channel(f"private:{user.id}", ChannelType.DIRECT)
|
|
150
214
|
return Event(
|
|
@@ -597,7 +597,10 @@ def decode_segments(event: dict) -> list[Element]:
|
|
|
597
597
|
if seg_type == "text":
|
|
598
598
|
result.append(E.text(i["text"]))
|
|
599
599
|
elif seg_type == "mention_user":
|
|
600
|
-
|
|
600
|
+
if i["user_id"] == "all":
|
|
601
|
+
result.append(E.at_all())
|
|
602
|
+
else:
|
|
603
|
+
result.append(E.at(i["user_id"]))
|
|
601
604
|
elif seg_type == "mention_channel":
|
|
602
605
|
result.append(E.sharp(i["channel_id"]))
|
|
603
606
|
elif seg_type == "emoji":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/main.py
RENAMED
|
File without changes
|
{satori_python_adapter_qq-0.3.3 → satori_python_adapter_qq-0.4.0rc1}/src/satori/adapters/qq/utils.py
RENAMED
|
File without changes
|
|
File without changes
|