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.

19 lines
712 B

local nick,chan,tCommand,message = ...
local mpdHost = "192.168.1.17"
if tCommand[2] == "current" then
sendchan(chan,io.popen("mpc -h "..mpdHost.." current"):read("*a"))
elseif tCommand[2] == "playlist" then
io.popen("mpc -h "..mpdHost.." playlist > ~/public_html/mpd-playlist.txt")
sendchan(chan,"http://lain.shadowkat.science/~izaya/mpd-playlist.txt")
elseif tCommand[2] == "raw" then
if checkAdmin(nick) then
local _,s = string.find(message,"raw")
local restofcommand = message:sub(s+1)
local data = io.popen("mpc " .. restofcommand .. " | head -n 1"):read("*a")
sendchan(chan,data)
else
sendchan(chan,"Not authorized.")
end
else
sendchan(chan,":mpd subcommands: current, playlist, raw")
end