add commands

This commit is contained in:
stryan 2021-12-19 17:49:03 -05:00
parent ca4a8fd0fa
commit 952ec87ba4
1 changed files with 32 additions and 2 deletions

34
main.rb
View File

@ -28,12 +28,42 @@ if File.exists?("/usr/bin/mpd")
system("systemctl start mpd") unless `ps aux | grep mpd` != ""
system("mpc clear")
system("mpc add /")
system("mpc repeat")
mpd = true
end
bot = Discordrb::Bot.new token: options[:bot_token]
bot = Discordrb::Commands::CommandBot.new token: options[:bot_token], prefix: '!'
bot.command :start do |event|
system("mpc play")
event.respond("starting radio")
end
bot.command :stop do |event|
system("mpc stop")
event.respond("stoping radio")
end
bot.command :reload do |event|
event.respond("reloading queue")
system("mpc stop")
system("mpc clear")
system("mpc update")
system("mpc add /")
end
bot.command :pause do |event|
event.respond("pausing playback")
system("mpc pause")
end
bot.command :skip do |event|
event.respond("skipping")
system("mpc next")
end
bot.message(in: options[:channel_id],contains: "youtube.com") do |event|
event.respond("got message")
urls = URI.extract(event.content)
if urls != ""
puts "Found #{urls}; downloading"