basic volume settings
This commit is contained in:
parent
6d69421305
commit
6c2ce758d6
1 changed files with 14 additions and 1 deletions
15
main.py
15
main.py
|
|
@ -12,6 +12,10 @@ bot = commands.Bot(command_prefix="..", intents=intents)
|
|||
# Global variable to hold the current voice client
|
||||
voice_client = None
|
||||
|
||||
# Sets the default volume to 20%, to make headphone users survive
|
||||
# the volume does not change when the bot is already playing, only new audio
|
||||
current_volume = 0.20
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
# Construct the invite URL dynamically
|
||||
|
|
@ -62,7 +66,7 @@ async def play(ctx, url: str):
|
|||
|
||||
ffmpeg_options = {
|
||||
"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5 -protocol_whitelist file,http,https,tcp,tls,crypto",
|
||||
"options": "-vn"
|
||||
"options": f"-vn -af volume={current_volume}"
|
||||
}
|
||||
|
||||
voice_client.play(
|
||||
|
|
@ -84,6 +88,15 @@ async def stop(ctx):
|
|||
else:
|
||||
await ctx.send("nem is szól semmi te buzeráns fasz")
|
||||
|
||||
@bot.command()
|
||||
async def volume(ctx, vol: float):
|
||||
global current_volume
|
||||
if 0.0 <= vol <= 2.0:
|
||||
current_volume = vol
|
||||
await ctx.send(f"hangerő most {vol*100:.0f}%")
|
||||
else:
|
||||
await ctx.send("0.0 és 2.0 között add meg te szerencsétlen")
|
||||
|
||||
@bot.command()
|
||||
async def leave(ctx):
|
||||
global voice_client
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue