Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@sopel.module.interval(3600)
def refresh_page_cache(bot):
jarvis.core.refresh()
@sopel.module.interval(21600)
def announce_bday(bot):
announce = []
dict = readjson()
res = datetonext(dict)
for people in res:
if people[1].days == 0:
announce.append(people[0])
if announce:
bot.say("Happy Birthday {0}!".format(", ".join(announce)))
@module.interval(300)
# Testing Intervals
#@module.interval(15)
def track_shift_rotation(bot):
""" Sends a message if there was a change in the rotation withnin the last 10 minutes
(if bot has appropriate channel permissions)."""
print("Checking shift rotation " + str(datetime.datetime.utcnow()))
rotation = get_rotation()
for channel in bot.channels:
if bot.db.get_channel_value(channel, 'monitoring'):
announce_escalation(bot, channel, rotation)
@sopel.module.interval(20)
def monitor_streamers(bot):
streaming_names = []
try:
streaming = twitch_api(streamers)
except Exception as e:
return print("There was an error reading twitch API {0}".format(e))
results = []
if streaming.get("streams"):
twitch_gen = twitch_generator(streaming)
for streamer in twitch_gen:
if streamer["name"] not in currently_streaming:
currently_streaming[streamer["name"]] = streamer["game"], {'cooldown': 0, 'starttime': streamer["starttime"]}
results.append("%s just went live playing %s! [%s] (%s - %s viewer%s)" % (streamer["name"],
streamer["game"],
streamer["status"],
streamer["url"],
@sopel.module.interval(86400)
def refresh_results(bot):
fullresults = []
for k in db.keys('*'):
fullresults.extend(db.smembers(k))
fullmodel = WaffleBotText("\n".join([r.decode('utf8') for r in fullresults]), state_size=3)
@sopel.module.interval(3600)
def refresh(bot):
jarvis.core.refresh()