4040
4141
4242@asyncio .coroutine
43- def delete_reminder (async , db , network , remind_time , user ):
43+ def delete_reminder (async_call , db , network , remind_time , user ):
4444 query = table .delete () \
4545 .where (table .c .network == network .lower ()) \
4646 .where (table .c .remind_time == remind_time ) \
4747 .where (table .c .added_user == user .lower ())
48- yield from async (db .execute , query )
49- yield from async (db .commit )
48+ yield from async_call (db .execute , query )
49+ yield from async_call (db .commit )
5050
5151
5252@asyncio .coroutine
53- def delete_all (async , db , network , user ):
53+ def delete_all (async_call , db , network , user ):
5454 query = table .delete () \
5555 .where (table .c .network == network .lower ()) \
5656 .where (table .c .added_user == user .lower ())
57- yield from async (db .execute , query )
58- yield from async (db .commit )
57+ yield from async_call (db .execute , query )
58+ yield from async_call (db .commit )
5959
6060
6161@asyncio .coroutine
62- def add_reminder (async , db , network , added_user , added_chan , message , remind_time , added_time ):
62+ def add_reminder (async_call , db , network , added_user , added_chan , message , remind_time , added_time ):
6363 query = table .insert ().values (
6464 network = network .lower (),
6565 added_user = added_user .lower (),
@@ -68,17 +68,17 @@ def add_reminder(async, db, network, added_user, added_chan, message, remind_tim
6868 message = message ,
6969 remind_time = remind_time
7070 )
71- yield from async (db .execute , query )
72- yield from async (db .commit )
71+ yield from async_call (db .execute , query )
72+ yield from async_call (db .commit )
7373
7474
7575@asyncio .coroutine
7676@hook .on_start ()
77- def load_cache (async , db ):
77+ def load_cache (async_call , db ):
7878 global reminder_cache
7979 reminder_cache = []
8080
81- for network , remind_time , added_time , user , message in (yield from async (_load_cache_db , db )):
81+ for network , remind_time , added_time , user , message in (yield from async_call (_load_cache_db , db )):
8282 reminder_cache .append ((network , remind_time , added_time , user , message ))
8383
8484
@@ -89,16 +89,16 @@ def _load_cache_db(db):
8989
9090@asyncio .coroutine
9191@hook .periodic (30 , initial_interval = 30 )
92- def check_reminders (bot , async , db ):
92+ def check_reminders (bot , async_call , db ):
9393 current_time = datetime .now ()
9494
9595 for reminder in reminder_cache :
9696 network , remind_time , added_time , user , message = reminder
9797 if remind_time <= current_time :
9898 if network not in bot .connections :
9999 # connection is invalid
100- yield from add_reminder (async , db , network , remind_time , user )
101- yield from load_cache (async , db )
100+ yield from add_reminder (async_call , db , network , remind_time , user )
101+ yield from load_cache (async_call , db )
102102 continue
103103
104104 conn = bot .connections [network ]
@@ -119,13 +119,13 @@ def check_reminders(bot, async, db):
119119 " it seems I was unable to deliver it on time)" .format (late_time )
120120 conn .message (user , colors .parse (late ))
121121
122- yield from delete_reminder (async , db , network , remind_time , user )
123- yield from load_cache (async , db )
122+ yield from delete_reminder (async_call , db , network , remind_time , user )
123+ yield from load_cache (async_call , db )
124124
125125
126126@asyncio .coroutine
127127@hook .command ('remind' , 'reminder' , 'in' )
128- def remind (text , nick , chan , db , conn , notice , async ):
128+ def remind (text , nick , chan , db , conn , notice , async_call ):
129129 """<1 minute, 30 seconds>: <do task> -- reminds you to <do task> in <1 minute, 30 seconds>"""
130130
131131 count = len ([x for x in reminder_cache if x [0 ] == conn .name and x [3 ] == nick .lower ()])
@@ -134,8 +134,8 @@ def remind(text, nick, chan, db, conn, notice, async):
134134 if count == 0 :
135135 return "You have no reminders to delete."
136136
137- yield from delete_all (async , db , conn .name , nick )
138- yield from load_cache (async , db )
137+ yield from delete_all (async_call , db , conn .name , nick )
138+ yield from load_cache (async_call , db )
139139 return "Deleted all ({}) reminders for {}!" .format (count , nick )
140140
141141 # split the input on the first ":"
@@ -171,8 +171,8 @@ def remind(text, nick, chan, db, conn, notice, async):
171171 return "I can't remind you in the past!"
172172
173173 # finally, add the reminder and send a confirmation message
174- yield from add_reminder (async , db , conn .name , nick , chan , message , remind_time , current_time )
175- yield from load_cache (async , db )
174+ yield from add_reminder (async_call , db , conn .name , nick , chan , message , remind_time , current_time )
175+ yield from load_cache (async_call , db )
176176
177177 remind_text = format_time (seconds , count = 2 )
178178 output = "Alright, I'll remind you \" {}\" in $(b){}$(clear)!" .format (message , remind_text )
0 commit comments