depend on ln
This commit is contained in:
parent
bb14de2846
commit
f953cad787
|
@ -16,6 +16,7 @@ dependencies = {
|
||||||
"lua ~> 5.3",
|
"lua ~> 5.3",
|
||||||
"irc-engine",
|
"irc-engine",
|
||||||
"luasocket",
|
"luasocket",
|
||||||
|
"ln",
|
||||||
}
|
}
|
||||||
build = {
|
build = {
|
||||||
type = "builtin",
|
type = "builtin",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
irce = require "irce"
|
irce = require "irce"
|
||||||
|
ln = require "ln"
|
||||||
moon = require "moon"
|
moon = require "moon"
|
||||||
stringx = require "pl.stringx"
|
stringx = require "pl.stringx"
|
||||||
|
|
||||||
|
@ -31,6 +32,8 @@ stringx = require "pl.stringx"
|
||||||
switch string.upper cmd
|
switch string.upper cmd
|
||||||
when "VHOST"
|
when "VHOST"
|
||||||
if #args > 0
|
if #args > 0
|
||||||
|
ln.log
|
||||||
|
:sender, vhost: args[1], action: "setting vhost"
|
||||||
self\VHOST sender, args[1]
|
self\VHOST sender, args[1]
|
||||||
self\PRIVMSG "Ketracel", sender, "your vhost is now " ..args[1]
|
self\PRIVMSG "Ketracel", sender, "your vhost is now " ..args[1]
|
||||||
else
|
else
|
||||||
|
|
|
@ -72,6 +72,24 @@ moon = require "moon"
|
||||||
sender, params[1]
|
sender, params[1]
|
||||||
|
|
||||||
["NICK"]: (state, sender, params) =>
|
["NICK"]: (state, sender, params) =>
|
||||||
|
if #params == 1
|
||||||
|
oldnick = sender[1]
|
||||||
|
oldnicksmall = string.lower oldnick
|
||||||
|
newnick = params[1]
|
||||||
|
cli = state.clients[oldnicksmall]
|
||||||
|
cli.nick = newnick
|
||||||
|
state.clients[string.lower oldnicksmall] = nil
|
||||||
|
nick = string.lower newnick
|
||||||
|
state.clients[string.lower newnick] = cli
|
||||||
|
|
||||||
|
for k, v in pairs state.channels
|
||||||
|
for kk, vv in pairs v.members
|
||||||
|
if kk == oldnicksmall
|
||||||
|
v.members[nick] = v.members[oldnicksmall]
|
||||||
|
v.members[oldnicksmall] = nil
|
||||||
|
|
||||||
|
return sender, state.clients[nick]
|
||||||
|
|
||||||
nick = params[1]
|
nick = params[1]
|
||||||
user = params[3]
|
user = params[3]
|
||||||
host = params[4]
|
host = params[4]
|
||||||
|
@ -82,7 +100,7 @@ moon = require "moon"
|
||||||
state.clients[string.lower nick] =
|
state.clients[string.lower nick] =
|
||||||
:nick, :user, :host, :modes, :real, :metadata
|
:nick, :user, :host, :modes, :real, :metadata
|
||||||
|
|
||||||
sender, state.clients[nick]
|
sender, state.clients[string.lower nick]
|
||||||
|
|
||||||
["METADATA"]: (state, sender, params) =>
|
["METADATA"]: (state, sender, params) =>
|
||||||
nick = params[1]
|
nick = params[1]
|
||||||
|
@ -129,6 +147,10 @@ moon = require "moon"
|
||||||
:name, :mode, :topic, :key, :limit, members: {}
|
:name, :mode, :topic, :key, :limit, members: {}
|
||||||
|
|
||||||
["PRIVMSG"]: (state, sender, params) =>
|
["PRIVMSG"]: (state, sender, params) =>
|
||||||
|
if params[2] == "?state"
|
||||||
|
moon.p state
|
||||||
|
return sender, params
|
||||||
|
|
||||||
if sender[1] == "Cadey" and stringx.startswith params[2], "?eval"
|
if sender[1] == "Cadey" and stringx.startswith params[2], "?eval"
|
||||||
code = string.sub(params[2], 7)
|
code = string.sub(params[2], 7)
|
||||||
print string.format "%s %s %s - evaling", params[1], sender[1], code
|
print string.format "%s %s %s - evaling", params[1], sender[1], code
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
irce = require "irce"
|
irce = require "irce"
|
||||||
|
ln = require "ln"
|
||||||
socket = require "socket"
|
socket = require "socket"
|
||||||
|
|
||||||
config =
|
config =
|
||||||
|
@ -23,10 +24,11 @@ irc\set_send_func (message) =>
|
||||||
client\send message
|
client\send message
|
||||||
|
|
||||||
if config.debug
|
if config.debug
|
||||||
|
ln.log config
|
||||||
irc\set_callback irce.RAW, (send, message) =>
|
irc\set_callback irce.RAW, (send, message) =>
|
||||||
print string.format "%s %s", (send and ">" or "<"), message
|
print string.format "%s %s", (send and ">" or "<"), message
|
||||||
|
|
||||||
print "Ketracel loaded using " .. irce._VERSION .. " running on " .. _VERSION
|
ln.log msg: "Ketracel loaded", irce: irce._VERSION, lua: _VERSION
|
||||||
|
|
||||||
-- connect to irc server
|
-- connect to irc server
|
||||||
assert client\connect config.server, 6667
|
assert client\connect config.server, 6667
|
||||||
|
|
Loading…
Reference in New Issue