From 07b25767295e105cf5b4cddc9b2d6dab69fde192 Mon Sep 17 00:00:00 2001 From: Choco Date: Wed, 6 Aug 2025 10:48:44 +0800 Subject: [PATCH] Fix send function context handling and queueType key Updated the send function to correctly handle TempCtx and only include 'ephemeral' if supported by the send function. Also fixed the key from 'queue_type' to 'queueType' in the Player's IPC message for consistency with expected API. --- function.py | 9 ++++++--- voicelink/player.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/function.py b/function.py index 207342c..d7b3010 100644 --- a/function.py +++ b/function.py @@ -211,8 +211,9 @@ async def send( # Determine the sending function send_func = ( - ctx.send if isinstance(ctx, commands.Context) else - ctx.followup.send if ctx.response.is_done() else + ctx.send if isinstance(ctx, commands.Context) else + ctx.channel.send if isinstance(ctx, TempCtx) else + ctx.followup.send if ctx.response.is_done() else ctx.response.send_message ) @@ -221,7 +222,6 @@ async def send( send_kwargs = { "content": text, "embed": embed, - "ephemeral": ephemeral, "allowed_mentions": ALLOWED_MENTIONS, "silent": settings.get("silent_msg", False), } @@ -231,6 +231,9 @@ async def send( delete_after = 10 send_kwargs["delete_after"] = delete_after + if "ephemeral" in send_func.__code__.co_varnames: + send_kwargs["ephemeral"] = ephemeral + if view: send_kwargs["view"] = view diff --git a/voicelink/player.py b/voicelink/player.py index 3f80f15..7d5d49e 100644 --- a/voicelink/player.py +++ b/voicelink/player.py @@ -788,7 +788,7 @@ class Player(VoiceProtocol): if self.is_ipc_connected: await self.send_ws({ "op": "clearQueue", - "queue_type": queue_type + "queueType": queue_type }, requester) async def remove_filter(self, filter_tag: str, requester: Member = None, fast_apply: bool = False) -> Filters: