Updated stuff.

This commit is contained in:
Izaya 2016-01-15 08:33:18 +11:00
parent 35bcb741f2
commit 1e6af48fb9
4 changed files with 22 additions and 9 deletions

View File

@ -5,6 +5,15 @@ if tCommand[2] == "current" then
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,":mpd subcommands: current, playlist")
sendchan(chan,"Not authorized.")
end
else
sendchan(chan,":mpd subcommands: current, playlist, raw")
end

View File

@ -1,5 +1,5 @@
{server="irc.freenode.net",
nick="yukichan2",
{server="irc.quakenet.org",
nick="yukichan",
hostname="lain",
servername="lain",
realname="yuki",
@ -19,8 +19,8 @@ mpd="mpd.lua"
timers={
"highfive.lua"
},
debug=false,
autojoin=false,
debug=true,
autojoin=true,
prefix=":",
username="yuki",
port=6667,

View File

@ -1,6 +1,6 @@
tArgs = {...}
local nick, chan, message = tArgs[1],tArgs[2],tArgs[3]
if message:find("o/") ~= nil or message:find("\\o") ~= nil then
if (message:find("o/") ~= nil or message:find("\\o") ~= nil) and message:find("\\o/") == nil then
if nick ~= "Shocky" then
if _G.leftHanging[2] == false then
print (nick .." left hanging at "..os.time())

View File

@ -161,6 +161,10 @@ function parsemsg(nick,chan,message)
print("Killed by "..nick)
os.exit(1)
end
elseif tCommand[1] == "debug" then
if checkAdmin(nick) then
config.debug = not config.debug
end
elseif cmds[tCommand[1]] ~= nil then
local fail, errors = pcall(cmds[tCommand[1]],nick,chan,tCommand,message)
if not fail then print(errors) end
@ -172,7 +176,7 @@ function parse(line)
if string.find(line, "PING :") == 1 then
local _,pingid = string.match(line,"([^,]+):([^,]+)")
writeln("PONG :"..pingid)
print("Pinged: "..pingid)
print("[Ping] "..pingid)
elseif string.find(line,":") == 1 and string.find(line,"PRIVMSG") ~= nil and string.find(line,"005") == nil then
local s = string.sub(line,2) -- I
local ms,me = string.find(s,"!") -- me = match end, ms = match start
@ -190,7 +194,7 @@ function parse(line)
local chan, msg = string.match(s,"([^,]+) :([^\n]+)") -- terrible
if chan == config.nick then chan = nick end
]]--
print(nick,chan,msg) --person
print("["..chan.."] <"..nick.."> "..msg) --person
parsemsg(nick,chan,msg)
end
end
@ -235,7 +239,7 @@ function main()
repeat
line = connection:receive()
if line ~= nil and line ~= "timeout" then
print(line)
if config.debug then print(line) end
pcall(parse,line)
else
--[[ if (line == "timeout" or line == nil) and os.time() > _G.lastping + config.timeout then