depend on ln

This commit is contained in:
Cadey Ratio 2019-12-25 14:17:05 +00:00
parent bb14de2846
commit f953cad787
4 changed files with 30 additions and 2 deletions

View File

@ -16,6 +16,7 @@ dependencies = {
"lua ~> 5.3",
"irc-engine",
"luasocket",
"ln",
}
build = {
type = "builtin",

View File

@ -1,4 +1,5 @@
irce = require "irce"
ln = require "ln"
moon = require "moon"
stringx = require "pl.stringx"
@ -31,6 +32,8 @@ stringx = require "pl.stringx"
switch string.upper cmd
when "VHOST"
if #args > 0
ln.log
:sender, vhost: args[1], action: "setting vhost"
self\VHOST sender, args[1]
self\PRIVMSG "Ketracel", sender, "your vhost is now " ..args[1]
else

View File

@ -72,6 +72,24 @@ moon = require "moon"
sender, params[1]
["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]
user = params[3]
host = params[4]
@ -82,7 +100,7 @@ moon = require "moon"
state.clients[string.lower nick] =
:nick, :user, :host, :modes, :real, :metadata
sender, state.clients[nick]
sender, state.clients[string.lower nick]
["METADATA"]: (state, sender, params) =>
nick = params[1]
@ -129,6 +147,10 @@ moon = require "moon"
:name, :mode, :topic, :key, :limit, members: {}
["PRIVMSG"]: (state, sender, params) =>
if params[2] == "?state"
moon.p state
return sender, params
if sender[1] == "Cadey" and stringx.startswith params[2], "?eval"
code = string.sub(params[2], 7)
print string.format "%s %s %s - evaling", params[1], sender[1], code

View File

@ -1,4 +1,5 @@
irce = require "irce"
ln = require "ln"
socket = require "socket"
config =
@ -23,10 +24,11 @@ irc\set_send_func (message) =>
client\send message
if config.debug
ln.log config
irc\set_callback irce.RAW, (send, 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
assert client\connect config.server, 6667