예제 #1
0
def create_reminder(message, people, content, trigger_time, freq):
    for user in list(people.split()):
        if int(freq) <= 0:
            t_time = datetime.strptime(trigger_time, '%b-%d-%Y_%H:%M:%S')
            schedule.once(t_time).do(
                message.send, "Hey, %s! It's time to do some work:\n %s" % (user, content))
        else:
            schedule.every(int(freq)).seconds.do(
                message.send, "Hey, %s! It's time to do some work again:\n %s" % (user, content))
예제 #2
0
파일: example.py 프로젝트: unode/mmpy_bot
    def schedule_every(self, message: Message, seconds: int):
        """Schedules a reply every x seconds. Use the `cancel jobs` command to stop.

        Arguments:
        - seconds (int): number of seconds between each reply.
        """
        schedule.every(int(seconds)).seconds.do(
            self.driver.reply_to, message,
            f"Scheduled message every {seconds} seconds!")
예제 #3
0
파일: main.py 프로젝트: Xarboule/techthebot
def citation_auto(message):
    global quote_enabled
    if (quote_enabled == False):
        message.reply("Citations activées : une citation toute les 12 heures")
        schedule.every(12 * 3600).seconds.do(reply_random_quote, message)
        quote_enabled = True
    else:
        message.reply("Citations désactivées")
        schedule.clear()
        quote_enabled = False
예제 #4
0
def reply_every_seconds(message, content, seconds):
    schedule.every(int(seconds)).seconds.do(message.reply, content)
예제 #5
0
def watch_key(message, key):
    utils.reply(message, "start observing key {key}".format(key=key))
    schedule.every(20).seconds.do(lambda: utils.reply(message, kv.eget(key)))
예제 #6
0
def observe_results(message):
    ks = kv.part_keys("raw_result")
    for k in ks:
        message.reply("start observing key {key}".format(key=k))
        schedule.every(20).seconds.do(lambda: utils.reply(message, kv.eget(k)))
예제 #7
0
def observe_info(message):
    message.reply("start observing key info")
    schedule.every(20).seconds.do(lambda: utils.reply(message, kv.eget('info@0')))
예제 #8
0
def observe_target_pressure(message): 
    message.reply("start observing key target_pressure")
    schedule.every(20).seconds.do(lambda: utils.reply(message, kv.eget('current_target_pressure@0')))