How to use the sopel.module.interval function in sopel

To help you get started, we’ve selected a few sopel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anqxyr / jarvis / jarvis / modules / scp.py View on Github external
@sopel.module.interval(3600)
def refresh_page_cache(bot):
    jarvis.core.refresh()
github dasu / syrup-sopel-modules / bday.py View on Github external
@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)))
github openshift / openshift-tools / openshift_tools / ircbot / openshift_sre / openshift_sre.py View on Github external
@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)
github dasu / syrup-sopel-modules / twitch.py View on Github external
@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"],
github dasu / syrup-sopel-modules / wafflebot.py View on Github external
@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)
github anqxyr / jarvis / jarvis / modules / jarvis_irc.py View on Github external
@sopel.module.interval(3600)
def refresh(bot):
    jarvis.core.refresh()