Switched to OpusVoice

This commit is contained in:
Lukas Blacha
2023-02-07 22:01:19 +01:00
parent 9735a408c9
commit b286d8338e

View File

@@ -76,8 +76,9 @@ else:
data = data["entries"][0] data = data["entries"][0]
filename = data["url"] if stream else ytdl.prepare_filename(data) filename = data["url"] if stream else ytdl.prepare_filename(data)
return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data) #return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)
return cls(discord.FFmpegOpusAudio(bitrate=128, codec=None, executable='ffmpeg', pipe=False, stderr=None,
before_options=None, options=ffmpeg_options), data=data)
intents = discord.Intents.default() intents = discord.Intents.default()
intents.message_content = True intents.message_content = True
@@ -103,15 +104,15 @@ else:
async def join(ctx: commands.Context): async def join(ctx: commands.Context):
try: try:
channel = ctx.author.voice.channel channel = ctx.author.voice.channel
if channel is None:
await ctx.send(f"{error}You are not in a voice-channel! Could not join...")
if ctx.voice_client is not None:
return await ctx.voice_client.move_to(channel)
await ctx.respond(f"{success}Connected to `{channel.name}`")
await channel.connect()
except Exception as err: except Exception as err:
print(err) print(err)
if channel is None:
await ctx.send(f"{error}You are not in a voice-channel! Could not join...")
if ctx.voice_client is not None:
return await ctx.voice_client.move_to(channel)
await ctx.respond(f"{success}Connected to `{channel.name}`")
await channel.connect()
@bot.slash_command(name="nowplaying", descriprion="Show details what the bot is currently playing") @bot.slash_command(name="nowplaying", descriprion="Show details what the bot is currently playing")
@@ -221,4 +222,9 @@ else:
await ctx.send(embed=embed) await ctx.send(embed=embed)
bot.run(args.token, bot=True, reconnect=True) try:
bot.loop.run_until_complete(bot.start(token=args.token, reconnect=True))
except KeyboardInterrupt:
bot.loop.run_until_complete(bot.close())
finally:
bot.loop.close()