Changes from #hackerspace-pl
This commit is contained in:
parent
99004b7b2d
commit
ad098c433e
3 changed files with 38 additions and 5 deletions
|
@ -29,7 +29,7 @@ local FormatData = function(Rate, Key)
|
||||||
return string.format("%.2f %s", Value, Currency)
|
return string.format("%.2f %s", Value, Currency)
|
||||||
end
|
end
|
||||||
|
|
||||||
local DefaultRates = {'mtgoxUSD', 'mtgoxPLN', 'bitcurexPLN'}
|
local DefaultRates = {'btceUSD', 'bitcurexPLN'}
|
||||||
plugin.AddCommand('btc', 0, function(Username, Channel)
|
plugin.AddCommand('btc', 0, function(Username, Channel)
|
||||||
local Rates = GetRates()
|
local Rates = GetRates()
|
||||||
for _, Key in pairs(DefaultRates) do
|
for _, Key in pairs(DefaultRates) do
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
local SpaceAPI = {}
|
local SpaceAPI = {}
|
||||||
SpaceAPI['#hackerspace-pl'] = 'https://hackerspace.pl/spaceapi'
|
SpaceAPI['#hackerspace-pl'] = 'https://hackerspace.pl/spaceapi'
|
||||||
|
SpaceAPI['#hackerspace-pl-members'] = 'https://hackerspace.pl/spaceapi'
|
||||||
SpaceAPI['#hackerspace-krk'] = 'https://hskrk-spacemon.herokuapp.com/'
|
SpaceAPI['#hackerspace-krk'] = 'https://hskrk-spacemon.herokuapp.com/'
|
||||||
|
|
||||||
plugin.AddCommand('at', 0, function(Username, Channel)
|
plugin.AddCommand('at', 0, function(Username, Channel)
|
||||||
|
@ -90,14 +91,14 @@ local function SayDue(Target, Channel)
|
||||||
end
|
end
|
||||||
|
|
||||||
plugin.AddCommand('due', 1, function(Username, Channel, Target)
|
plugin.AddCommand('due', 1, function(Username, Channel, Target)
|
||||||
if Channel.Name ~= '#hackerspace-pl' then
|
if not WarsawHackerspaceChannels[Channel.Name] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
SayDue(Target, Channel)
|
SayDue(Target, Channel)
|
||||||
end, "Show months due for user.")
|
end, "Show months due for user.")
|
||||||
|
|
||||||
plugin.AddCommand('due-me', 0, function(Username, Channel)
|
plugin.AddCommand('due-me', 0, function(Username, Channel)
|
||||||
if Channel.Name ~= '#hackerspace-pl' then
|
if not WarsawHackerspaceChannels[Channel.Name] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
SayDue(Username, Channel)
|
SayDue(Username, Channel)
|
||||||
|
@ -105,7 +106,7 @@ end, "Show months due for speaker.")
|
||||||
|
|
||||||
Nagged = {}
|
Nagged = {}
|
||||||
plugin.AddHook('irc.Message', 'nag', function(Username, Channel, Message)
|
plugin.AddHook('irc.Message', 'nag', function(Username, Channel, Message)
|
||||||
if Channel.Name ~= '#hackerspace-pl' then
|
if not WarsawHackerspaceChannels[Channel.Name] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local Target = Username:lower()
|
local Target = Username:lower()
|
||||||
|
@ -126,8 +127,18 @@ plugin.AddHook('irc.Message', 'nag', function(Username, Channel, Message)
|
||||||
end
|
end
|
||||||
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)
|
plugin.AddCommand('mana', 0, function(Username, Channel)
|
||||||
if Channel.Name ~= '#hackerspace-pl' then
|
if not WarsawHackerspaceChannels[Channel.Name] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local Body, Code, Headers, Status = https.request('https://kasownik.hackerspace.pl/api/mana.json')
|
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))
|
irc:_Send(string.format("MODE %s +o %s", Channel, Target))
|
||||||
end, "Give operator status to someone on the channel.", 40)
|
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")
|
||||||
|
|
|
@ -37,6 +37,7 @@ plugin.AddCommand('eval', -1, function(User, Channel, String)
|
||||||
Env._G = Env
|
Env._G = Env
|
||||||
Env.DBI = nil
|
Env.DBI = nil
|
||||||
Env.https = nil
|
Env.https = nil
|
||||||
|
Env.json = nil
|
||||||
Env.print = function(...)
|
Env.print = function(...)
|
||||||
local Args = {...}
|
local Args = {...}
|
||||||
local Output = table.concat(Args, "\t")
|
local Output = table.concat(Args, "\t")
|
||||||
|
|
Loading…
Reference in a new issue