cmd_admin.py

changeset 65
20bd76353eb5
parent 64
384167adad2b
child 66
74d8ca04ff01
--- a/cmd_admin.py	Wed Nov 05 01:38:08 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-from commandhandler import command_error
-import hgapi
-
-ModuleData = {
-	'commands':
-	[
-		{
-			'name': 'raw',
-			'description': 'Sends a raw message to the server',
-			'args': '<message...>',
-			'level': 'admin',
-		},
-
-		{
-			'name': 'msg',
-			'description': 'Sends a message to someone',
-			'args': '<recipient> <message...>',
-			'level': 'admin',
-		},
-
-		{
-			'name': 'restart',
-			'description': 'Restarts the bot',
-			'args': None,
-			'level': 'admin',
-		},
-
-		{
-			'name': 'update',
-			'description': 'Checks for updates on the bot',
-			'args': None,
-			'level': 'admin'
-		}
-	]
-}
-
-def cmd_raw (bot, args, **rest):
-	bot.write (args['message'])
-
-def cmd_msg (bot, args, **rest):
-	bot.privmsg (args['recipient'], args['message'])
-
-def cmd_restart (bot, **rest):
-	bot.restart()
-
-def cmd_update (bot, replyto, **rest):
-	try:
-		repo = hgapi.Repo ('.')
-		r1 = repo.hg_id()
-		repo.hg_pull()
-		repo.hg_update('tip', True)
-		r2 = repo.hg_id()
-		if r1 != r2:
-			bot.privmsg (replyto, 'Updated to %s, restarting...' % r2)
-			bot.restart()
-		else:
-			bot.privmsg (replyto, 'Up to date at %s.' % r2)
-	except hgapi.HgException as e:
-		command_error ('Update failed: %s' % str (e))

mercurial