Преглед изворни кода

Reminders that expire while the bot is offline trigger after startup.

tags/v0.3
Ben Kurtovic пре 8 година
родитељ
комит
7dfc38bb5c
2 измењених фајлова са 8 додато и 4 уклоњено
  1. +2
    -1
      CHANGELOG
  2. +6
    -3
      earwigbot/commands/remind.py

+ 2
- 1
CHANGELOG Прегледај датотеку

@@ -3,7 +3,8 @@ v0.3 (unreleased):
- Copyvio detector: improved sentence splitting algorithm.
- IRC > !notes: Improved help and added aliases.
- IRC > !remind: Added !remind all. Fixed multithreading efficiency issues.
Improved time detection and argument parsing.
Improved time detection and argument parsing. Newly expired reminders are now
triggered on bot startup.
- IRC > !stalk: Allow regular expressions as page titles or usernames.
- IRC: Improved detection of maximum IRC message length.
- IRC: Improved some help commands.


+ 6
- 3
earwigbot/commands/remind.py Прегледај датотеку

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
# Copyright (C) 2009-2016 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -188,10 +188,13 @@ class Remind(Command):
return
permdb.set_attr("command:remind", "data", "[]")

connect_wait = 30
for item in ast.literal_eval(database):
rid, user, wait, end, message, data = item
if end < time.time():
continue
if end < time.time() + connect_wait:
# Make reminders that have expired while the bot was offline
# trigger shortly after startup
end = time.time() + connect_wait
data = Data.unserialize(data)
reminder = _Reminder(rid, user, wait, message, data, self, end)
self._start_reminder(reminder, user)


Loading…
Откажи
Сачувај