Changes from #hackerspace-pl

master
q3k 2015-03-13 23:53:44 +01:00
parent 99004b7b2d
commit ad098c433e
3 changed files with 38 additions and 5 deletions

View File

@ -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

View File

@ -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")

View File

@ -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")