diff --git a/plugins/bitcoin.lua b/plugins/bitcoin.lua index be82ea3..9c3080d 100644 --- a/plugins/bitcoin.lua +++ b/plugins/bitcoin.lua @@ -29,7 +29,7 @@ local FormatData = function(Rate, Key) return string.format("%.2f %s", Value, Currency) end -local DefaultRates = {'mtgoxUSD', 'mtgoxPLN', 'bitcurexPLN'} +local DefaultRates = {'btceUSD', 'bitcurexPLN'} plugin.AddCommand('btc', 0, function(Username, Channel) local Rates = GetRates() for _, Key in pairs(DefaultRates) do diff --git a/plugins/hackerspace.lua b/plugins/hackerspace.lua index 96c6bc7..8735c77 100644 --- a/plugins/hackerspace.lua +++ b/plugins/hackerspace.lua @@ -1,5 +1,6 @@ local SpaceAPI = {} SpaceAPI['#hackerspace-pl'] = 'https://hackerspace.pl/spaceapi' +SpaceAPI['#hackerspace-pl-members'] = 'https://hackerspace.pl/spaceapi' SpaceAPI['#hackerspace-krk'] = 'https://hskrk-spacemon.herokuapp.com/' plugin.AddCommand('at', 0, function(Username, Channel) @@ -90,14 +91,14 @@ local function SayDue(Target, Channel) end plugin.AddCommand('due', 1, function(Username, Channel, Target) - if Channel.Name ~= '#hackerspace-pl' then + if not WarsawHackerspaceChannels[Channel.Name] then return end SayDue(Target, Channel) end, "Show months due for user.") plugin.AddCommand('due-me', 0, function(Username, Channel) - if Channel.Name ~= '#hackerspace-pl' then + if not WarsawHackerspaceChannels[Channel.Name] then return end SayDue(Username, Channel) @@ -105,7 +106,7 @@ end, "Show months due for speaker.") Nagged = {} plugin.AddHook('irc.Message', 'nag', function(Username, Channel, Message) - if Channel.Name ~= '#hackerspace-pl' then + if not WarsawHackerspaceChannels[Channel.Name] then return end local Target = Username:lower() @@ -126,8 +127,18 @@ plugin.AddHook('irc.Message', 'nag', function(Username, Channel, Message) end end) +plugin.AddHook('irc.Message', 'winner', function(Username, Channel, Message) + if Username ~= 'ood' and Message == '1st' then + Channel._irc:_Send("kick " .. Channel.Name .. " " .. Username .. " :we have a winner!") + end +end) + +WarsawHackerspaceChannels = {} +WarsawHackerspaceChannels["#hackerspace-pl"] = true +WarsawHackerspaceChannels["#hackerspace-pl-members"] = true + plugin.AddCommand('mana', 0, function(Username, Channel) - if Channel.Name ~= '#hackerspace-pl' then + if not WarsawHackerspaceChannels[Channel.Name] then return end local Body, Code, Headers, Status = https.request('https://kasownik.hackerspace.pl/api/mana.json') @@ -180,3 +191,24 @@ plugin.AddCommand('op', 1, function(Username, Channel, Target) irc:_Send(string.format("MODE %s +o %s", Channel, Target)) end, "Give operator status to someone on the channel.", 40) +bandnames = nil +bandnames_check = nil + +plugin.AddCommand('kapela', 0, function(Username, Channel) + if bandnames_check == nil or bandnames_check + 3600 < os.time() then + local Body, Code, Headers = https.request('http://www.reddit.com/r/Bandnames/top/.json?sort=top&t=month') + if Code ~= 200 then + Channel:Say("Reddit API doesn't like us, got " .. tostring(Code)) + return + end + local Data = json.decode.decode(Body) + bandnames = {} + for k, v in pairs(Data['data']['children']) do + bandnames[#bandnames+1] = v['data']['title'] + end + bandnames_check = os.time() + end + -- fuck I forgot to expose random() to the API + local Bandname = bandnames[(os.time() % #bandnames) + 1] + Channel:Say(Bandname) +end, "Get a bandname from /r/Bandnames") diff --git a/plugins/repl.lua b/plugins/repl.lua index ef34da8..6ba707a 100644 --- a/plugins/repl.lua +++ b/plugins/repl.lua @@ -37,6 +37,7 @@ plugin.AddCommand('eval', -1, function(User, Channel, String) Env._G = Env Env.DBI = nil Env.https = nil + Env.json = nil Env.print = function(...) local Args = {...} local Output = table.concat(Args, "\t")