Skip to content

Commit 034b5b3

Browse files
committed
Prepare for 1.0.6
1 parent 68229ea commit 034b5b3

File tree

4 files changed

+38
-12
lines changed

4 files changed

+38
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
## Changelog
2+
- **1.0.6**
3+
* Added pig latin translator, requires new *nltk* module
4+
* Added reminder command
5+
* Added new periodic hook (does not support reloading properly yet, so use with caution)
6+
* Added priority sorting to sieve hooks
7+
* Started work on new documentation for 1.1
8+
* Did some minor internal refactoring
29
- **1.0.5** - Fix geoip for queries with no region, fix youtube bug, add flip command
310
- **1.0.4** - Adjust ratelimiter cleanup task, add octopart API key, fix brainfuck, sort mcstatus output.
411
- **1.0.3** - More minor changes to plugins, fixed rate-limiting properly, banished SCP to CloudBotIRC/Plugins, added wildcard support to permissions (note: don't use this yet, it's still not entirely finalized!)

cloudbot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import logging
1111
import os
1212

13-
__version__ = "1.0.5"
13+
__version__ = "1.0.6"
1414

1515
__all__ = ["util", "bot", "connection", "config", "permissions", "plugin", "event", "hook", "log_dir"]
1616

cloudbot/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def load_config(self):
6969

7070
# reload permissions
7171
if self.bot.connections:
72-
for connection in self.bot.connections:
72+
for connection in self.bot.connections.values():
7373
connection.permissions.reload()
7474

7575
def save_config(self):

plugins/remind.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,31 @@
3939

4040

4141
@asyncio.coroutine
42-
def delete_reminder(async, db, network, remind_time, added_user):
42+
def delete_reminder(async, db, network, remind_time, user):
4343
query = table.delete() \
44-
.where(table.c.network == network) \
44+
.where(table.c.network == network.lower()) \
4545
.where(table.c.remind_time == remind_time) \
46-
.where(table.c.added_user == added_user)
46+
.where(table.c.added_user == user.lower())
47+
yield from async(db.execute, query)
48+
yield from async(db.commit)
49+
50+
51+
@asyncio.coroutine
52+
def delete_all(async, db, network, user):
53+
query = table.delete() \
54+
.where(table.c.network == network.lower()) \
55+
.where(table.c.added_user == user.lower())
4756
yield from async(db.execute, query)
4857
yield from async(db.commit)
4958

5059

5160
@asyncio.coroutine
5261
def add_reminder(async, db, network, added_user, added_chan, message, remind_time, added_time):
5362
query = table.insert().values(
54-
network=network,
63+
network=network.lower(),
5564
added_user=added_user.lower(),
5665
added_time=added_time,
57-
added_chan=added_chan,
66+
added_chan=added_chan.lower(),
5867
message=message,
5968
remind_time=remind_time
6069
)
@@ -78,7 +87,7 @@ def _load_cache_db(db):
7887

7988

8089
@asyncio.coroutine
81-
@hook.periodic(2.5, initial_interval=30)
90+
@hook.periodic(30, initial_interval=30)
8291
def check_reminders(bot, async, db):
8392
current_time = datetime.now()
8493

@@ -114,9 +123,19 @@ def check_reminders(bot, async, db):
114123

115124

116125
@asyncio.coroutine
117-
@hook.command('remind')
126+
@hook.command('remind', 'reminder')
118127
def remind(text, nick, chan, db, conn, notice, async):
119-
"""remind <1 minute, 30 seconds>: <do task> -- reminds you to <do task> in <1 minute, 30 seconds>"""
128+
"""<1 minute, 30 seconds>: <do task> -- reminds you to <do task> in <1 minute, 30 seconds>"""
129+
130+
count = len([x for x in reminder_cache if x[0] == conn.name and x[3] == nick.lower()])
131+
132+
if text == "clear":
133+
if count == 0:
134+
return "You have no reminders to delete."
135+
136+
yield from delete_all(async, db, conn.name, nick)
137+
yield from load_cache(async, db)
138+
return "Deleted all ({}) reminders for {}!".format(count, nick)
120139

121140
# split the input on the first ":"
122141
parts = text.split(":", 1)
@@ -126,9 +145,9 @@ def remind(text, nick, chan, db, conn, notice, async):
126145
notice(remind.__doc__)
127146
return
128147

129-
count = len([x for x in reminder_cache if x[0] == conn.name and x[3] == nick.lower()])
130148
if count > 10:
131-
return "Sorry, you already have too many reminders queued, you will need to wait or clear your reminders to add any more."
149+
return "Sorry, you already have too many reminders queued (10), you will need to wait or " \
150+
"clear your reminders to add any more."
132151

133152
time_string = parts[0].strip()
134153
message = colors.strip_all(parts[1].strip())

0 commit comments

Comments
 (0)