|
@@ -8,8 +8,14 @@ require 'net/http'
|
|
|
require 'json'
|
|
|
require 'youtube-dl.rb'
|
|
|
|
|
|
-settings = YAML.load(File.read "config.yaml")['settings']
|
|
|
-bot = Discordrb::Commands::CommandBot.new token: settings['token'], prefix: settings['prefix']
|
|
|
+$settings = YAML.load(File.read "config.yaml")['settings']
|
|
|
+bot = Discordrb::Commands::CommandBot.new token: $settings['token'], prefix: $settings['prefix']
|
|
|
+
|
|
|
+def save_settings
|
|
|
+ File.open("config.yaml", 'w') do |file|
|
|
|
+ file.write(YAML.dump({'settings' => $settings}))
|
|
|
+ end
|
|
|
+end
|
|
|
|
|
|
bot.command(:translit) do |_event, script, *text|
|
|
|
_event.message.mentions.each do |user|
|
|
@@ -164,6 +170,7 @@ bot.command(:play, description: "Plays 'music' of your choosing in your voice ch
|
|
|
channel = _event.user.voice_channel
|
|
|
next "You're not in any voice channel!" unless channel
|
|
|
voice_bot = bot.voice_connect(channel)
|
|
|
+ voice_bot.volume = $settings['volume']
|
|
|
fairqueues[_event.server] = FairQueue.new(voice_bot)
|
|
|
end
|
|
|
|
|
@@ -210,7 +217,8 @@ 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
|
|
|
+ $settings['volume'] = _event.voice.volume = [volume.to_f, 1.5].min
|
|
|
+ save_settings
|
|
|
|
|
|
""
|
|
|
end
|