first commit
This commit is contained in:
commit
a2e649bb34
|
@ -0,0 +1,12 @@
|
|||
Copyright (c) 2019 Christine Dodrill <me@christine.website>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
|
@ -0,0 +1 @@
|
|||
: foreach *.moon |> ^ Moon: %f -> %o^ moonc %f 2> /dev/null |> %B.lua
|
|
@ -0,0 +1,27 @@
|
|||
package = "ketracel"
|
||||
version = "scm-1"
|
||||
source = {
|
||||
url = "https://tulpa.dev/cadey/ketracel"
|
||||
}
|
||||
description = {
|
||||
homepage = "https://tulpa.dev/cadey/ketracel",
|
||||
license = "0bsd",
|
||||
summary = "a small security bot for ngircd",
|
||||
labels = {
|
||||
"irc",
|
||||
"security"
|
||||
}
|
||||
}
|
||||
dependencies = {
|
||||
"lua ~> 5.3",
|
||||
"irc-engine",
|
||||
"luasocket",
|
||||
}
|
||||
build_dependencies = {
|
||||
"moonscript",
|
||||
"busted",
|
||||
}
|
||||
build = {
|
||||
type = "builtin",
|
||||
modules = {}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
tup
|
||||
lua5.3 -l set_paths ./src/ketracel.lua
|
|
@ -0,0 +1,4 @@
|
|||
-- set_paths.lua
|
||||
local version = _VERSION:match("%d+%.%d+")
|
||||
package.path = 'lua_modules/share/lua/' .. version .. '/?.lua;lua_modules/share/lua/' .. version .. '/?/init.lua;' .. package.path
|
||||
package.cpath = 'lua_modules/lib/lua/' .. version .. '/?.so;' .. package.cpath
|
|
@ -0,0 +1,3 @@
|
|||
include_rules
|
||||
.gitignore
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
irce = require "irce"
|
||||
socket = require "socket"
|
||||
print irce._VERSION .. " running on " .. _VERSION
|
||||
|
||||
config =
|
||||
server: "127.0.0.1"
|
||||
nick: os.getenv("IRC_NICK") or "Ketracel"
|
||||
user: os.getenv("IRC_USER") or "white"
|
||||
real: os.getenv("IRC_REAL") or "The favorite of the Jem'Hadar"
|
||||
oper: os.getenv("IRC_OPER")
|
||||
channels: { "#ketracel", "#opers" }
|
||||
|
||||
irc = irce.new!
|
||||
running = true
|
||||
|
||||
assert irc\load_module require "irce.modules.base"
|
||||
assert irc\load_module require "irce.modules.message"
|
||||
assert irc\load_module require "irce.modules.channel"
|
||||
assert irc\load_module require "irce.modules.motd"
|
||||
|
||||
client = socket.tcp!
|
||||
irc\set_send_func (message) =>
|
||||
client\send message
|
||||
client\settimeout 1
|
||||
|
||||
irc\set_callback irce.RAW, (send, message) =>
|
||||
print string.format "%s %s", (send and ">" or "<"), message
|
||||
|
||||
irc\set_callback "CTCP", (sender, origin, command, params, pm) =>
|
||||
if command == "VERSION"
|
||||
self\CTCP_REPLY origin, "VERSION", string.format("Ketracel white - dev (%s, %s)", irce._VERSION, _VERSION)
|
||||
|
||||
irc\set_callback "001", (...) =>
|
||||
for k, chan in ipairs config.channels
|
||||
assert irc\JOIN chan
|
||||
|
||||
irc\set_callback "PRIVMSG", (sender, origin, message, pm) =>
|
||||
if message == "?quit"
|
||||
assert self\QUIT "Ran out of white"
|
||||
running = false
|
||||
|
||||
assert client\connect config.server, 6667
|
||||
|
||||
assert irc\NICK config.nick
|
||||
assert irc\USER config.user, config.real
|
||||
|
||||
if config.oper
|
||||
client\send "OPER " .. config.nick .. " " .. config.oper .. "\r\n"
|
||||
|
||||
while running
|
||||
irc\process client\receive!
|
||||
|
||||
client\close!
|
Loading…
Reference in New Issue