Updated stuff.
This commit is contained in:
parent
35bcb741f2
commit
1e6af48fb9
11
cmds/mpd.lua
11
cmds/mpd.lua
@ -5,6 +5,15 @@ if tCommand[2] == "current" then
|
|||||||
elseif tCommand[2] == "playlist" then
|
elseif tCommand[2] == "playlist" then
|
||||||
io.popen("mpc -h "..mpdHost.." playlist > ~/public_html/mpd-playlist.txt")
|
io.popen("mpc -h "..mpdHost.." playlist > ~/public_html/mpd-playlist.txt")
|
||||||
sendchan(chan,"http://lain.shadowkat.science/~izaya/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
|
else
|
||||||
sendchan(chan,":mpd subcommands: current, playlist")
|
sendchan(chan,"Not authorized.")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
sendchan(chan,":mpd subcommands: current, playlist, raw")
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{server="irc.freenode.net",
|
{server="irc.quakenet.org",
|
||||||
nick="yukichan2",
|
nick="yukichan",
|
||||||
hostname="lain",
|
hostname="lain",
|
||||||
servername="lain",
|
servername="lain",
|
||||||
realname="yuki",
|
realname="yuki",
|
||||||
@ -19,8 +19,8 @@ mpd="mpd.lua"
|
|||||||
timers={
|
timers={
|
||||||
"highfive.lua"
|
"highfive.lua"
|
||||||
},
|
},
|
||||||
debug=false,
|
debug=true,
|
||||||
autojoin=false,
|
autojoin=true,
|
||||||
prefix=":",
|
prefix=":",
|
||||||
username="yuki",
|
username="yuki",
|
||||||
port=6667,
|
port=6667,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
tArgs = {...}
|
tArgs = {...}
|
||||||
local nick, chan, message = tArgs[1],tArgs[2],tArgs[3]
|
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 nick ~= "Shocky" then
|
||||||
if _G.leftHanging[2] == false then
|
if _G.leftHanging[2] == false then
|
||||||
print (nick .." left hanging at "..os.time())
|
print (nick .." left hanging at "..os.time())
|
||||||
|
10
init.lua
10
init.lua
@ -161,6 +161,10 @@ function parsemsg(nick,chan,message)
|
|||||||
print("Killed by "..nick)
|
print("Killed by "..nick)
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
|
elseif tCommand[1] == "debug" then
|
||||||
|
if checkAdmin(nick) then
|
||||||
|
config.debug = not config.debug
|
||||||
|
end
|
||||||
elseif cmds[tCommand[1]] ~= nil then
|
elseif cmds[tCommand[1]] ~= nil then
|
||||||
local fail, errors = pcall(cmds[tCommand[1]],nick,chan,tCommand,message)
|
local fail, errors = pcall(cmds[tCommand[1]],nick,chan,tCommand,message)
|
||||||
if not fail then print(errors) end
|
if not fail then print(errors) end
|
||||||
@ -172,7 +176,7 @@ function parse(line)
|
|||||||
if string.find(line, "PING :") == 1 then
|
if string.find(line, "PING :") == 1 then
|
||||||
local _,pingid = string.match(line,"([^,]+):([^,]+)")
|
local _,pingid = string.match(line,"([^,]+):([^,]+)")
|
||||||
writeln("PONG :"..pingid)
|
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
|
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 s = string.sub(line,2) -- I
|
||||||
local ms,me = string.find(s,"!") -- me = match end, ms = match start
|
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
|
local chan, msg = string.match(s,"([^,]+) :([^\n]+)") -- terrible
|
||||||
if chan == config.nick then chan = nick end
|
if chan == config.nick then chan = nick end
|
||||||
]]--
|
]]--
|
||||||
print(nick,chan,msg) --person
|
print("["..chan.."] <"..nick.."> "..msg) --person
|
||||||
parsemsg(nick,chan,msg)
|
parsemsg(nick,chan,msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -235,7 +239,7 @@ function main()
|
|||||||
repeat
|
repeat
|
||||||
line = connection:receive()
|
line = connection:receive()
|
||||||
if line ~= nil and line ~= "timeout" then
|
if line ~= nil and line ~= "timeout" then
|
||||||
print(line)
|
if config.debug then print(line) end
|
||||||
pcall(parse,line)
|
pcall(parse,line)
|
||||||
else
|
else
|
||||||
--[[ if (line == "timeout" or line == nil) and os.time() > _G.lastping + config.timeout then
|
--[[ if (line == "timeout" or line == nil) and os.time() > _G.lastping + config.timeout then
|
||||||
|
Loading…
Reference in New Issue
Block a user