Switched to OpusVoice
This commit is contained in:
16
Music-Bot.py
16
Music-Bot.py
@@ -76,8 +76,9 @@ else:
|
||||
data = data["entries"][0]
|
||||
|
||||
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.message_content = True
|
||||
@@ -103,8 +104,6 @@ else:
|
||||
async def join(ctx: commands.Context):
|
||||
try:
|
||||
channel = ctx.author.voice.channel
|
||||
except Exception as 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:
|
||||
@@ -112,6 +111,8 @@ else:
|
||||
|
||||
await ctx.respond(f"{success}Connected to `{channel.name}`")
|
||||
await channel.connect()
|
||||
except Exception as err:
|
||||
print(err)
|
||||
|
||||
|
||||
@bot.slash_command(name="nowplaying", descriprion="Show details what the bot is currently playing")
|
||||
@@ -221,4 +222,9 @@ else:
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user