I'm trying to make a bot that can join on command to play the 'Open the noor' sound as a joke for a friend. But every time I launch it and run the command, it connects but just sits there, it doesnt even disconnect like it does from the dedicated leave command. I'm scratching my head as to what I'm doing wrong here.
The logs don't have anything out of the ordinary, aside from it not printing the log message "Noored". The bot not leaving aa well tells me it gets hung up on the audio portion.
The command in question is the noor command.
ffmpeg is installed and in the system PATH.
import discord
from discord.ext import commands
import logging
handler = logging.FileHandler(filename='abyssal_log.log', encoding='utf-8', mode='w')
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='/', intents=intents)
token = #Omitted
@bot.event
async def on_ready():
print('Ready')
@bot.command()
async def hello(ctx):
await ctx.send("Hello!")
@bot.command()
async def jabberjoin(ctx):
await ctx.author.voice.channel.connect()
print('Bot joined')
@bot.command()
async def jabberleave(ctx):
await ctx.voice_client.disconnect()
print('Bot left')
@bot.command()
async def noor(ctx):
vc = await ctx.author.voice.channel.connect()
await vc.play(discord.FFmpegPCMAudio('noor.mp3'))
await ctx.voice_client.disconnect()
print('Noored')
bot.run(token, log_handler=handler)