Explorar o código

Add simple volume control

Frans Bergman %!s(int64=5) %!d(string=hai) anos
pai
achega
cebe1fd573
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      main.rb

+ 8 - 0
main.rb

@@ -207,5 +207,13 @@ bot.command(:queue, description: "Lists the impending torture.") do |_event|
     queue.queue.each_with_index.map{|video, i| "#{i + 1}. #{format_title(video)}"}.join("\n")
     queue.queue.each_with_index.map{|video, i| "#{i + 1}. #{format_title(video)}"}.join("\n")
 end
 end
 
 
+bot.command(:volume, description: "Sets the severity of currently playing 'music'.") do |_event, volume|
+    next "Nothing is playing." unless _event.voice
+
+    _event.voice.volume = [volume.to_f, 1.5].min
+
+    ""
+end
+
 
 
 bot.run
 bot.run