|
|
|
@ -1,34 +1,43 @@
|
|
|
|
|
def playMusic(bot, bang)
|
|
|
|
|
def playMusic_initialize(bot, bang)
|
|
|
|
|
bot.message(start_with: "#{bang}Play ") do |event|
|
|
|
|
|
message = event.content
|
|
|
|
|
author = event.author
|
|
|
|
|
voice_channel = author.voice_channel.id
|
|
|
|
|
server = event.server
|
|
|
|
|
arguments = message.sub("#{bang}Play ", '').split.first
|
|
|
|
|
#event.voice.play_file('./example.mp3')
|
|
|
|
|
if arguments.include? "&list"
|
|
|
|
|
event.respond "Do not play playlists. They are unsupported."
|
|
|
|
|
elsif ENV["#{voice_channel}"] == 'playing'
|
|
|
|
|
event.respond "Music currently playing. Adding to queue"
|
|
|
|
|
if $queue.key?(voice_channel) == false
|
|
|
|
|
$queue[voice_channel] = Array.new
|
|
|
|
|
$queue[voice_channel].push arguments
|
|
|
|
|
puts $queue[voice_channel]
|
|
|
|
|
else
|
|
|
|
|
$queue[voice_channel].push arguments
|
|
|
|
|
puts $queue[voice_channel]
|
|
|
|
|
end
|
|
|
|
|
elsif arguments.include? "youtu"
|
|
|
|
|
actuallyPlayMusic(bot, event, arguments, voice_channel, server)
|
|
|
|
|
else
|
|
|
|
|
event.respond "Invalid youtube link!"
|
|
|
|
|
end
|
|
|
|
|
playMusic(bot, event, bang)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
bot.message(with_text: "#{bang}Play") do |event|
|
|
|
|
|
event.respond "Please provide youtube link!"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def playMusic_defined()
|
|
|
|
|
puts "This should not run"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def playMusic(bot, event, bang)
|
|
|
|
|
message = event.content
|
|
|
|
|
author = event.author
|
|
|
|
|
voice_channel = author.voice_channel.id
|
|
|
|
|
server = event.server
|
|
|
|
|
arguments = message.sub("#{bang}Play ", '').split.first
|
|
|
|
|
#event.voice.play_file('./example.mp3')
|
|
|
|
|
if arguments.include? "&list"
|
|
|
|
|
event.respond "Do not play playlists. They are unsupported."
|
|
|
|
|
elsif ENV["#{voice_channel}"] == 'playing'
|
|
|
|
|
event.respond "Music currently playing. Adding to queue"
|
|
|
|
|
if $queue.key?(voice_channel) == false
|
|
|
|
|
$queue[voice_channel] = Array.new
|
|
|
|
|
$queue[voice_channel].push arguments
|
|
|
|
|
puts $queue[voice_channel]
|
|
|
|
|
else
|
|
|
|
|
$queue[voice_channel].push arguments
|
|
|
|
|
puts $queue[voice_channel]
|
|
|
|
|
end
|
|
|
|
|
elsif arguments.include? "youtu"
|
|
|
|
|
actuallyPlayMusic(bot, event, arguments, voice_channel, server)
|
|
|
|
|
else
|
|
|
|
|
event.respond "Invalid youtube link!"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def actuallyPlayMusic(bot, event, arguments, voice_channel, server)
|
|
|
|
|
event.respond "Playing song! This may take some time."
|
|
|
|
|
bot.voice_connect(voice_channel)
|
|
|
|
|