Browse Source

No longer require '!' and call variables variables instead of keys.

Douglas William Thrift 14 years ago
parent
commit
8bcdf9b38c
1 changed files with 23 additions and 25 deletions
  1. 23 25
      locationbot.py

+ 23 - 25
locationbot.py

@@ -108,8 +108,8 @@ class LocationBot(ircbot.SingleServerIRCBot):
 		if login:
 			commands.update({
 				'logout': ('', 'log out as nick'),
-				'set': ('[key [value]]', 'display or set variables'),
-				'unset': ('key', 'unset a variable'),
+				'set': ('[variable [value]]', 'display or set variables'),
+				'unset': ('variable', 'unset a variable'),
 			})
 
 		if admin:
@@ -123,7 +123,7 @@ class LocationBot(ircbot.SingleServerIRCBot):
 		connection.privmsg(nick, 'Command     Arguments               Description')
 
 		def help(command, arguments, description):
-			connection.privmsg(nick, '!%-10s %-23s %s' % (command, arguments, description))
+			connection.privmsg(nick, '%-11s %-23s %s' % (command, arguments, description))
 
 		if command in commands:
 			help(command, *commands[command])
@@ -285,7 +285,7 @@ class LocationBot(ircbot.SingleServerIRCBot):
 			connection.privmsg(nick, '%-23s %-36s %s' % (_nick, location, timezone.normalize(updated.astimezone(timezone)).strftime('%Y-%m-%d %H:%M %Z')))
 
 	def __unknown(self, connection, nick, command):
-		connection.privmsg(nick, 'unknown command ("!%s"); try "!help"' % command)
+		connection.privmsg(nick, 'unknown command ("%s"); try "help"' % command)
 
 	def __unknown_variable(self, connection, nick, variable):
 		connection.privmsg(nick, 'unknown variable ("%s")' % variable)
@@ -375,27 +375,25 @@ class LocationBot(ircbot.SingleServerIRCBot):
 		if command.startswith('!'):
 			command = command[1:]
 
-			if command == 'help':
-				self.__help(connection, nick, admin, login, arguments)
-			elif command == 'login':
-				self.__login(connection, nickmask, nick, arguments)
-			elif command == 'status':
-				self.__status(connection, nick, login, arguments)
-			elif login and command == 'logout':
-				self.__logout(connection, nick)
-			elif login and command == 'unset':
-				self.__unset(connection, nick, login, arguments)
-			elif admin and command == 'reload':
-				self.__reload(connection, nick)
-			elif admin and command == 'restart':
-				self.__restart(connection)
-			elif admin and command == 'say':
-				self.__say(connection, nick, arguments)
-			elif admin and command == 'who':
-				self.__who(connection, nick)
-			else:
-				self.__unknown(connection, nick, command)
-		elif event.eventtype() == 'privmsg':
+		if command == 'help':
+			self.__help(connection, nick, admin, login, arguments)
+		elif command == 'login':
+			self.__login(connection, nickmask, nick, arguments)
+		elif command == 'status':
+			self.__status(connection, nick, login, arguments)
+		elif login and command == 'logout':
+			self.__logout(connection, nick)
+		elif login and command == 'unset':
+			self.__unset(connection, nick, login, arguments)
+		elif admin and command == 'reload':
+			self.__reload(connection, nick)
+		elif admin and command == 'restart':
+			self.__restart(connection)
+		elif admin and command == 'say':
+			self.__say(connection, nick, arguments)
+		elif admin and command == 'who':
+			self.__who(connection, nick)
+		else:
 			self.__unknown(connection, nick, command)
 
 	def on_quit(self, connection, event):