我希望用户能够更改我的不和谐音乐机器人的音量。我尝试过这样做,但似乎不起作用。我已经将 vc 定义为外面的“东西”,然后用它在 try 和 except 中播放音乐。我想知道这是否导致了问题。
elif contents.startswith("volume"):
volume = contents
volume = volume.strip("volume ")
volume = int(volume)
if volume <= 100:
volume = volume / 10
vc.source = discord.PCMVolumeTransformer(vc.source)
vc.source.volume = volume
else:
message.channel.send("Please give me a number between 0 and 100!")
Run Code Online (Sandbox Code Playgroud)