Jason R. Coombs committed 2d7ceed

Use irc 8.0 for simpler scheduling

Comments (0)

Files changed (2)

 import irc.client
+import irc.schedule
 import pkg_resources
 import pmxbot.itertools
 			log.exception("Unhandled exception transmitting message: %r", msg)
 	def _schedule_at(self, conn, name, channel, when, func, args, doc):
-		arguments = conn, channel, func, args
+		runner_func = functools.partial(self.background_runner, conn, channel,
+			func, args)
 		if isinstance(when,
 			midnight = datetime.time(0,0)
 			when = datetime.datetime.combine(when, midnight)
 		if isinstance(when, datetime.datetime):
-			cmd = irc.client.DelayedCommand.at_time(
-				when, self.background_runner, arguments)
+			cmd = irc.schedule.DelayedCommand.at_time(when, runner_func)
 		if not isinstance(when, datetime.time):
 			raise ValueError("when must be datetime, date, or time")
-		daily = datetime.timedelta(days=1)
-		# convert when to the next datetime matching this time
-		when = datetime.datetime.combine(, when)
-		if when <
-			when += daily
-		cmd = irc.client.PeriodicCommandFixedDelay.at_time(
-			when, daily, self.background_runner, arguments)
+		cmd = irc.schedule.PeriodicCommandFixedDelay.daily_at(when,
+			runner_func)
 	def on_welcome(self, connection, event):
-		"irc>=6.0.1,<8.0dev",
+		"irc>=8.0,<9.0dev",
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.