Lua IRC bot.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
712B

  1. local nick,chan,tCommand,message = ...
  2. local mpdHost = "192.168.1.17"
  3. if tCommand[2] == "current" then
  4. sendchan(chan,io.popen("mpc -h "..mpdHost.." current"):read("*a"))
  5. elseif tCommand[2] == "playlist" then
  6. io.popen("mpc -h "..mpdHost.." playlist > ~/public_html/mpd-playlist.txt")
  7. sendchan(chan,"http://lain.shadowkat.science/~izaya/mpd-playlist.txt")
  8. elseif tCommand[2] == "raw" then
  9. if checkAdmin(nick) then
  10. local _,s = string.find(message,"raw")
  11. local restofcommand = message:sub(s+1)
  12. local data = io.popen("mpc " .. restofcommand .. " | head -n 1"):read("*a")
  13. sendchan(chan,data)
  14. else
  15. sendchan(chan,"Not authorized.")
  16. end
  17. else
  18. sendchan(chan,":mpd subcommands: current, playlist, raw")
  19. end