dailies 1.1
This commit is contained in:
parent
af59c8d360
commit
a65c36ad9b
@ -27,7 +27,8 @@ function sleep (sec)
|
|||||||
return os.execute("sleep " .. tonumber(sec))
|
return os.execute("sleep " .. tonumber(sec))
|
||||||
end
|
end
|
||||||
|
|
||||||
while true do
|
function run_dailies (dailies)
|
||||||
|
while true do
|
||||||
sleep_duration = get_sleep_duration_sec()
|
sleep_duration = get_sleep_duration_sec()
|
||||||
print("sleep for " .. sleep_duration)
|
print("sleep for " .. sleep_duration)
|
||||||
|
|
||||||
@ -36,8 +37,15 @@ while true do
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
if get_weekday() == weekday then
|
time_table = os.date("*t", os.time())
|
||||||
|
time_table.weekday = get_weekday()
|
||||||
|
for i, fn in dailies do
|
||||||
|
message = fn(time_table)
|
||||||
|
if message then
|
||||||
print("send message " .. message)
|
print("send message " .. message)
|
||||||
sender:send({type = "message", channel = channel, message = message})
|
sender:send({type = "message", channel = channel, message = message})
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,12 +1,75 @@
|
|||||||
[general]
|
[general]
|
||||||
foo = "bar"
|
foo = "bar"
|
||||||
|
|
||||||
|
[dailies]
|
||||||
|
type = "lua"
|
||||||
|
children = ["irc"]
|
||||||
|
file = "lua/dailies.lua"
|
||||||
|
hour = 8
|
||||||
|
minute = 0
|
||||||
|
second = 0
|
||||||
|
channel = "#eightbar"
|
||||||
|
code = """
|
||||||
|
function chrimbus (time)
|
||||||
|
if time.day == 25 and time.month == 12 then
|
||||||
|
return "https://i.imgur.com/cDiJxrV.gif"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function februaryween (time)
|
||||||
|
if time.day == 14 and time.month == 2 then
|
||||||
|
return "http://s3images.coroflot.com/user_files/individual_files/302239_CauyLQoHZTkSJkkGnr3kVbFtw.jpg"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function monday (time)
|
||||||
|
if time.weekday == "monday" then
|
||||||
|
return "https://memegenerator.net/img/instances/66733493/you-dont-hate-mondays-you-hate-capitalism.jpg"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function tuesday (time)
|
||||||
|
if time.weekday == "tuesday" then
|
||||||
|
return "https://78.media.tumblr.com/996c6866874691590558dce00b394416/tumblr_nxyfp54u121rp1193o1_1280.png"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function wednesday (time)
|
||||||
|
if time.weekday == "wednesday" then
|
||||||
|
return "http://i0.kym-cdn.com/photos/images/original/001/091/264/665.jpg"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function thursday (time)
|
||||||
|
if time.weekday == "thursday" then
|
||||||
|
if time.day == 20 then
|
||||||
|
return "http://i1.kym-cdn.com/photos/images/newsfeed/001/245/590/bd8.jpg"
|
||||||
|
else
|
||||||
|
return "https://78.media.tumblr.com/b05de5acb40dfb4eca044526eed5bbfa/tumblr_inline_p59be6mrQp1scg9wt_540.png"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function friday (time)
|
||||||
|
if time.weekday == "friday" then
|
||||||
|
if time.day == 13 then
|
||||||
|
return "https://www.youtube.com/watch?v=9cPDdQs7iHs"
|
||||||
|
else
|
||||||
|
return "https://www.youtube.com/watch?v=kfVsfOSbJY0"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
run_dailies({chrimbus, februaryween, monday, tuesday, wednesday, thursday, friday})
|
||||||
|
"""
|
||||||
|
|
||||||
[irc]
|
[irc]
|
||||||
|
nickname = "tenquestionmarks2"
|
||||||
server = "irc.rizon.net"
|
server = "irc.rizon.net"
|
||||||
channels = ["#eightbar"]
|
channels = ["#eightbar"]
|
||||||
|
|
||||||
[discord]
|
#[discord]
|
||||||
token = "your token here"
|
#token = "your token here"
|
||||||
|
|
||||||
[stdin]
|
[stdin]
|
||||||
|
|
||||||
@ -120,11 +183,11 @@ parents = ["stdin", "discord", "irc"]
|
|||||||
[icced]
|
[icced]
|
||||||
type = "random"
|
type = "random"
|
||||||
parents = ["stdin", "discord", "irc"]
|
parents = ["stdin", "discord", "irc"]
|
||||||
pattern = "\\bicc?ed?\\b"
|
pattern = "(?i)\\bicc?ed?\\b"
|
||||||
responses = ["Did some carbon-based lifeform just say **I C E**?"]
|
responses = ["Did some carbon-based lifeform just say **I C E**?"]
|
||||||
|
|
||||||
[trout]
|
[trout]
|
||||||
type = "random"
|
type = "random"
|
||||||
parents = ["stdin", "discord", "irc"]
|
parents = ["stdin", "discord", "irc"]
|
||||||
pattern = "^?slap (.*)"
|
pattern = "^\\?slap (.*)"
|
||||||
responses = ["/me slaps $1 around a bit with a large trout", "/me slaps $1 around a bit with a large brick"]
|
responses = ["/me slaps $1 around a bit with a large trout", "/me slaps $1 around a bit with a large brick"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user