mun/start.lua

46 lines
1.2 KiB
Lua
Raw Normal View History

require('core.hook')
require('core.reactor')
2013-09-22 11:54:15 +00:00
require('core.irc')
require('core.bot')
2013-09-22 12:29:54 +00:00
require('core.plugin')
2013-09-22 11:54:15 +00:00
require('socket')
local https = require('ssl.https')
require('json')
hook.Add('info', 'repl-info', function(Message)
print('INFO: ' .. Message)
end)
hook.Add('debug', 'repl-debug', function(Message)
print('DEBUG: ' .. Message)
end)
hook.Add('irc.Connected', 'repl-connected', function()
irc:Join('#hackerspace-pl-bottest')
end)
reactor:Initialize()
2013-09-22 11:54:15 +00:00
bot:Initialize(irc, ',')
2013-09-22 12:29:54 +00:00
--[[bot:AddCommand('at', 0, function(Username, Channel)
2013-09-22 11:54:15 +00:00
local Body, Code, Headers, Status = https.request('https://at.hackerspace.pl/api')
if Code ~= 200 then
error(string.format("Status code returned: %i", Code))
end
local Data = json.decode.decode(Body)
local Users = {}
for K, User in pairs(Data.users) do
Users[#Users + 1] = User.login
end
Channel:Say(table.concat(Users, ','))
2013-09-22 12:29:54 +00:00
end, "Show who's at the Warsaw Hackerspace.")]]--
plugin.RunCode('test', [[plugin.CommandAdd('test', 0, function(Username, Channel)
Channel:Say('hello!')
end, "Test command.", 0)]])
2013-09-22 11:54:15 +00:00
irc:Connect('irc.freenode.net', 6667, 'moonspeak', 'moonspeak', 'moonspeak')
reactor:Run()