Browse Source

Updated stuff.

Izaya 2 years ago
parent
commit
1e6af48fb9
4 changed files with 22 additions and 9 deletions
  1. 10
    1
      cmds/mpd.lua
  2. 4
    4
      config.lua
  3. 1
    1
      hooks/highfive.lua
  4. 7
    3
      init.lua

+ 10
- 1
cmds/mpd.lua View File

@@ -5,6 +5,15 @@ if tCommand[2] == "current" then
5 5
 elseif tCommand[2] == "playlist" then
6 6
  io.popen("mpc -h "..mpdHost.." playlist > ~/public_html/mpd-playlist.txt")
7 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
8 17
 else
9
- sendchan(chan,":mpd subcommands: current, playlist")
18
+ sendchan(chan,":mpd subcommands: current, playlist, raw")
10 19
 end

+ 4
- 4
config.lua View File

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

+ 1
- 1
hooks/highfive.lua View File

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

+ 7
- 3
init.lua View File

@@ -161,6 +161,10 @@ function parsemsg(nick,chan,message)
161 161
     print("Killed by "..nick)
162 162
     os.exit(1)
163 163
    end
164
+  elseif tCommand[1] == "debug" then
165
+   if checkAdmin(nick) then
166
+    config.debug = not config.debug
167
+   end
164 168
   elseif cmds[tCommand[1]] ~= nil then
165 169
    local fail, errors = pcall(cmds[tCommand[1]],nick,chan,tCommand,message)
166 170
    if not fail then print(errors) end
@@ -172,7 +176,7 @@ function parse(line)
172 176
  if string.find(line, "PING :") == 1 then
173 177
   local _,pingid = string.match(line,"([^,]+):([^,]+)")
174 178
   writeln("PONG :"..pingid)
175
-  print("Pinged: "..pingid)
179
+  print("[Ping] "..pingid)
176 180
  elseif string.find(line,":") == 1 and string.find(line,"PRIVMSG") ~= nil and string.find(line,"005") == nil then
177 181
   local s = string.sub(line,2) -- I
178 182
   local ms,me = string.find(s,"!") -- me = match end, ms = match start
@@ -190,7 +194,7 @@ function parse(line)
190 194
   local chan, msg = string.match(s,"([^,]+) :([^\n]+)") -- terrible
191 195
   if chan == config.nick then chan = nick end
192 196
   ]]--
193
-  print(nick,chan,msg) --person
197
+  print("["..chan.."] <"..nick.."> "..msg) --person
194 198
   parsemsg(nick,chan,msg)
195 199
  end
196 200
 end
@@ -235,7 +239,7 @@ function main()
235 239
  repeat
236 240
   line = connection:receive()
237 241
   if line ~= nil and line ~= "timeout" then
238
-   print(line)
242
+   if config.debug then print(line) end
239 243
    pcall(parse,line)
240 244
   else
241 245
 --[[   if (line == "timeout" or line == nil) and os.time() > _G.lastping + config.timeout then