IT DID SAVE!!!!

This commit is contained in:
Nexus 2023-03-22 15:02:46 +00:00
parent a1e00cd3bb
commit d9552cf6ec

View file

@ -161,7 +161,7 @@ class Events(commands.Cog):
member: discord.Member, member: discord.Member,
*_ *_
): ):
me_voice = member.guild.voice_state me_voice = member.guild.me.voice
if me_voice is None or me_voice.channel is None: if me_voice is None or me_voice.channel is None:
return return
@ -225,18 +225,21 @@ class Events(commands.Cog):
if message.channel.can_send(): # ... and we can send messages if message.channel.can_send(): # ... and we can send messages
if "it just works" in message.content.lower(): if "it just works" in message.content.lower():
file = Path.cwd() / "assets" / "it-just-works.ogg" file = Path.cwd() / "assets" / "it-just-works.ogg"
if message.author.voice is not None: if message.author.voice is not None and message.author.voice.channel is not None:
if message.guild.voice is not None: if message.guild.me.voice is not None:
await message.guild.voice.disconnect() await message.guild.me.voice.disconnect()
my_voice = await message.author.voice.channel.connect()
voice = await message.author.voice.channel.connect() voice = await message.author.voice.channel.connect()
voice.play( if voice.self_mute or voice.mute:
discord.FFmpegPCMAudio(str(file), stderr=subprocess.DEVNULL), await voice.disconnect()
after=lambda _: asyncio.run_coroutine_threadsafe( await message.reply("Unmute me >:(", file=discord.File(file))
voice.disconnect(), else:
self.bot.loop voice.play(
discord.FFmpegPCMAudio(str(file), stderr=subprocess.DEVNULL),
after=lambda _: asyncio.run_coroutine_threadsafe(
voice.disconnect(),
self.bot.loop
)
) )
)
else: else:
await message.reply(file=discord.File(file)) await message.reply(file=discord.File(file))