Skip to content

Commit 144a53f

Browse files
moemoliSoultergemini-code-assist[bot]
authored
fix: qq official guild message send error (#5287)
* fix: qq official guild message send error * Update astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent fa1d1e6 commit 144a53f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ async def _post_send(self, stream: dict | None = None):
200200
case botpy.message.Message():
201201
if image_path:
202202
payload["file_image"] = image_path
203+
# Guild text-channel send API (/channels/{channel_id}/messages) does not use v2 msg_type.
204+
payload.pop("msg_type", None)
203205
ret = await self._send_with_markdown_fallback(
204206
send_func=lambda retry_payload: self.bot.api.post_message(
205207
channel_id=source.channel_id,
@@ -212,6 +214,8 @@ async def _post_send(self, stream: dict | None = None):
212214
case botpy.message.DirectMessage():
213215
if image_path:
214216
payload["file_image"] = image_path
217+
# Guild DM send API (/dms/{guild_id}/messages) does not use v2 msg_type.
218+
payload.pop("msg_type", None)
215219
ret = await self._send_with_markdown_fallback(
216220
send_func=lambda retry_payload: self.bot.api.post_dms(
217221
guild_id=source.guild_id,

0 commit comments

Comments
 (0)