Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes voice client #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,11 @@ async def on_message(message):
# eventually py subclasses will replace this
##
if "!record " in message.content and message.author.id == helper_bot_id:
if get(bot.voice_clients, guild=message.guild) != None:
if get(bot.voice_clients, guild=message.guild).is_playing == True:
if message.guild.voice_client != None:
if message.guild.voice_client.is_playing() == True:

# not if you want to verify the property there are other ways

await message.delete()
return
contents = message.content.replace("!record ", "")
Expand All @@ -384,7 +387,7 @@ async def on_message(message):
asyncio.sleep(1)
member.move_to(channel)
#If the bot isn't joined, then join it.
voice_client = get(bot.voice_clients, guild=voice.channel.guild)
voice_client = message.guild.voice_client
if voice_client is None:
vc = await voice.channel.connect()
else:
Expand Down Expand Up @@ -426,16 +429,16 @@ async def on_message(message):
except:
raise
if "!tts" in message.content:
if get(bot.voice_clients, guild=message.guild) != None:
if get(bot.voice_clients, guild=message.guild).is_playing == True:
if message.guild.voice_client != None:
if message.guild.voice_client.is_playing() == True:
await message.delete()
return
contents = message.content.replace("!tts", "")
# auto-detect voice channel
channel = message.author.voice.channel
if not channel:
return
voice = get(bot.voice_clients, guild=message.guild)
voice = message.guild.voice_client
if voice and voice.is_connected():
await voice.move_to(channel)
else:
Expand All @@ -461,7 +464,7 @@ async def on_message(message):
channel = message.author.voice.channel
if not channel:
return
voice = get(bot.voice_clients, guild=message.guild)
voice = message.guild.voice_client
if voice and voice.is_connected():
await voice.move_to(channel)
else:
Expand Down