From 279cb1e98855e681e09e4215608083413454a0f6 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Sun, 22 Jul 2012 23:02:07 +0100 Subject: Start of a log script (for pisg) for Swiftob bots diff --git a/Swiftob/scripts/irssiLogs.lua b/Swiftob/scripts/irssiLogs.lua new file mode 100644 index 0000000..3cecd9d --- /dev/null +++ b/Swiftob/scripts/irssiLogs.lua @@ -0,0 +1,23 @@ +function irssi_log_to_file(muc, line) + filename = muc:gsub("@", "_at_") + filename = filename:gsub("%.%.", "_") + filename = filename:gsub("/", "_") + filename = filename:gsub("\\", "_") + file = io.open(filename, "a+") + if file == nil then + io.close() + else + file:write(line) + file:write("\n") + file:close() + end + +end + +function irssi_log_message(body, muc, nick, message) + time = os.date("%H:%M") + irssi_log_to_file(muc, time.." <"..nick.."> "..body) +end + +swiftob_register_listener(irssi_log_message) + -- cgit v0.10.2-6-g49f6