aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2025-04-06 14:45:48 +0100
committerGravatar Chris Lovering <[email protected]>2025-04-06 14:45:57 +0100
commit4736cb3a76bded7b785e6902719ed8a934f2a9a2 (patch)
tree79fba0c74bbf2e22329450cfc6ad3f22c6bcba34
parentNumbers (#319) (diff)
Allow moving the numbers elsewhere
-rw-r--r--arthur/exts/fun/numbers.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/arthur/exts/fun/numbers.py b/arthur/exts/fun/numbers.py
index bb7705e..a4df5a8 100644
--- a/arthur/exts/fun/numbers.py
+++ b/arthur/exts/fun/numbers.py
@@ -33,6 +33,9 @@ class Numbers(commands.GroupCog):
If channel is not provided, the bot will join the voice channel of the user who invoked the command.
"""
+ if not ctx.guild:
+ return
+
if not channel and isinstance(ctx.author, discord.Member) and (vs := ctx.author.voice):
channel = vs.channel
@@ -40,15 +43,11 @@ class Numbers(commands.GroupCog):
await ctx.send(":x: Join a voice channel first!")
return
- try:
- await self._join_and_play_numbers(channel)
- except discord.ClientException:
- # Already connected to a voice channel
- emoji = "🔇"
- else:
- emoji = "🔊"
+ if vc := ctx.guild.voice_client:
+ await vc.disconnect(force=True)
- await ctx.message.add_reaction(emoji)
+ await self._join_and_play_numbers(channel)
+ await ctx.message.add_reaction("🔊")
@numbers.command()
async def stop(self, ctx: commands.Context) -> None: