|
@@ -41,11 +41,11 @@ def do_command(self, connection, event, user, channel):
|
|
|
elif len(command.split()) == 2: # Command with one argument.
|
|
elif len(command.split()) == 2: # Command with one argument.
|
|
|
if command.split()[1] == 'list':
|
|
if command.split()[1] == 'list':
|
|
|
connection.privmsg(replyto, 'List categories: %s%s%s list categories%s List options: %s%s%slist options%s List definitions: %s%s%s list definitions' % (font.blue, self.network.command_character, one, font.reset, font.blue, self.network.command_character, one, font.reset, font.blue, self.network.command_character, one))
|
|
connection.privmsg(replyto, 'List categories: %s%s%s list categories%s List options: %s%s%slist options%s List definitions: %s%s%s list definitions' % (font.blue, self.network.command_character, one, font.reset, font.blue, self.network.command_character, one, font.reset, font.blue, self.network.command_character, one))
|
|
|
- elif command.split()[1].lower() in categories:
|
|
|
|
|
|
|
+ elif command.split()[1].lower() in [category.lower() for category in categories]:
|
|
|
if cmdtype == 'help':
|
|
if cmdtype == 'help':
|
|
|
connection.privmsg(replyto, 'Show a random %s' % command.split()[1])
|
|
connection.privmsg(replyto, 'Show a random %s' % command.split()[1])
|
|
|
else:
|
|
else:
|
|
|
- connection.privmsg(replyto, queries.random_vocabulary_item(self, command.split()[1].lower()))
|
|
|
|
|
|
|
+ connection.privmsg(replyto, str(queries.random_vocabulary_item(self, command.split()[1].lower())))
|
|
|
else:
|
|
else:
|
|
|
connection.privmsg(replyto, 'Invalid argument, for help type: %s%s%s' % (font.blue, self.network.command_character, one))
|
|
connection.privmsg(replyto, 'Invalid argument, for help type: %s%s%s' % (font.blue, self.network.command_character, one))
|
|
|
elif len(command.split()) == 3: # Command with two arguments.
|
|
elif len(command.split()) == 3: # Command with two arguments.
|
|
@@ -54,7 +54,7 @@ def do_command(self, connection, event, user, channel):
|
|
|
if cmdtype == 'help':
|
|
if cmdtype == 'help':
|
|
|
connection.privmsg(replyto, 'Lists available categories.')
|
|
connection.privmsg(replyto, 'Lists available categories.')
|
|
|
else: # List categories
|
|
else: # List categories
|
|
|
- connection.privmsg(replyto, ' ,'.join(categories))
|
|
|
|
|
|
|
+ connection.privmsg(replyto, ', '.join(categories))
|
|
|
elif command.split()[2] == 'options':
|
|
elif command.split()[2] == 'options':
|
|
|
if cmdtype == 'help':
|
|
if cmdtype == 'help':
|
|
|
connection.privmsg(replyto, 'Lists available options.')
|
|
connection.privmsg(replyto, 'Lists available options.')
|
|
@@ -62,59 +62,68 @@ def do_command(self, connection, event, user, channel):
|
|
|
connection.privmsg(replyto, 'add, info, ban')
|
|
connection.privmsg(replyto, 'add, info, ban')
|
|
|
elif command.split()[2] == 'definitions':
|
|
elif command.split()[2] == 'definitions':
|
|
|
if cmdtype == 'help':
|
|
if cmdtype == 'help':
|
|
|
- connection.privmsg(replyto, 'Lists definitions of categories.')
|
|
|
|
|
|
|
+ connection.privmsg(replyto, 'Lists definitions of definitions.')
|
|
|
else:
|
|
else:
|
|
|
connection.privmsg(replyto, 'CurseWord: A not to harsh swear word, let\'s keep it funny, not vulgar. Adjective: Something you would put in front of a curse word. NickReplyMessage: A response to when my name is mentioned. NickReplyAction: An action (Also know as emote or /me) in responce to when my name is mentioned.')
|
|
connection.privmsg(replyto, 'CurseWord: A not to harsh swear word, let\'s keep it funny, not vulgar. Adjective: Something you would put in front of a curse word. NickReplyMessage: A response to when my name is mentioned. NickReplyAction: An action (Also know as emote or /me) in responce to when my name is mentioned.')
|
|
|
else:
|
|
else:
|
|
|
connection.privmsg(replyto, 'Unkown list, options are %scategories%s and %soptions%s.' % (font.blue, font.reset,font.blue, font.reset))
|
|
connection.privmsg(replyto, 'Unkown list, options are %scategories%s and %soptions%s.' % (font.blue, font.reset,font.blue, font.reset))
|
|
|
- elif command.split()[1].lower() in categories:
|
|
|
|
|
|
|
+ elif command.split()[1].lower() in [category.lower() for category in categories]:
|
|
|
if command.split()[2] in ['add', 'info', 'ban']:
|
|
if command.split()[2] in ['add', 'info', 'ban']:
|
|
|
if cmdtype == 'help':
|
|
if cmdtype == 'help':
|
|
|
- connection.privmsg(replyto, 'Without specifiying add, display or ban, this displays a random %s' % command,split()[1])
|
|
|
|
|
|
|
+ connection.privmsg(replyto, 'Without specifiying add, display or ban, this displays a random %s' % command.split()[1])
|
|
|
else:
|
|
else:
|
|
|
- connection.privmsg(replyto, queries.random_vocabulary_item(self, commands.spit()[1]))
|
|
|
|
|
|
|
+ connection.privmsg(replyto, queries.random_vocabulary_item(self, commands.spit()[1].lower()))
|
|
|
else:
|
|
else:
|
|
|
connection.privmsg(replyto, 'Invalid option. Options are: add info ban')
|
|
connection.privmsg(replyto, 'Invalid option. Options are: add info ban')
|
|
|
else:
|
|
else:
|
|
|
connection.privmsg(replyto, 'Invalid catagory. To list valid categories use: %s%s%s list categories' % (font.blue, self.network.command_character, one))
|
|
connection.privmsg(replyto, 'Invalid catagory. To list valid categories use: %s%s%s list categories' % (font.blue, self.network.command_character, one))
|
|
|
elif len(command.split()) >= 4: # Command with three or more arguments.
|
|
elif len(command.split()) >= 4: # Command with three or more arguments.
|
|
|
- if command.split()[1].lower() in categories:
|
|
|
|
|
|
|
+ if command.split()[1].lower() in [category.lower() for category in categories]:
|
|
|
if command.split()[2] == 'add':
|
|
if command.split()[2] == 'add':
|
|
|
if cmdtype == 'help':
|
|
if cmdtype == 'help':
|
|
|
- connection.privmsg(replyto, 'Adds %s to %s' % (command.split()[3:], command.split()[1]))
|
|
|
|
|
|
|
+ connection.privmsg(replyto, 'Adds %s as %s' % (command.split()[3:][0], command.split()[1]))
|
|
|
else:
|
|
else:
|
|
|
- queries.add_vocabulary_item(self, table_suffix, user.id, command.split()[3:])
|
|
|
|
|
- connection.privmsg(replyto, '%s added to %s' % (command.split()[3:]), commands.split()[1])
|
|
|
|
|
|
|
+ item = queries.get_vocabulary_item(self, command.split()[1].lower(), command.split()[3:][0])
|
|
|
|
|
+ if item:
|
|
|
|
|
+ connection.privmsg(replyto, '%s already present as %s.' % (command.split()[3:][0], command.split()[1]))
|
|
|
|
|
+ else:
|
|
|
|
|
+ queries.add_vocabulary_item(self, command.split()[1].lower(), user.id, command.split()[3:][0])
|
|
|
|
|
+ connection.privmsg(replyto, '%s added as %s' % (command.split()[3:][0], command.split()[1]))
|
|
|
elif command.split()[2] == 'info':
|
|
elif command.split()[2] == 'info':
|
|
|
if cmdtype == 'help':
|
|
if cmdtype == 'help':
|
|
|
- connection.privmsg(replyto, 'Displays info on %s from %s' % (command.split()[3:], command.split()[1]))
|
|
|
|
|
|
|
+ connection.privmsg(replyto, 'Displays info on %s from %s.' % (command.split()[3:][0], command.split()[1]))
|
|
|
else:
|
|
else:
|
|
|
- item = queries.get_vocabulary_item(self, command.split()[1], command.split()[3:])
|
|
|
|
|
|
|
+ item = queries.get_vocabulary_item(self, command.split()[1].lower(), command.split()[3:][0])
|
|
|
if not item:
|
|
if not item:
|
|
|
- connection.privmsg(replyto, '%s is not in my vocabulary.' % command.split()[3:])
|
|
|
|
|
|
|
+ connection.privmsg(replyto, '%s is not in my vocabulary.' % command.split()[3:][0])
|
|
|
else:
|
|
else:
|
|
|
- if item.irc_user:
|
|
|
|
|
- item_user = item.irc_user
|
|
|
|
|
|
|
+ if item.irc_user_id:
|
|
|
|
|
+ item_user = item.irc_user_id
|
|
|
else:
|
|
else:
|
|
|
- item_user = item.web_user
|
|
|
|
|
|
|
+ item_user = item.web_user_id
|
|
|
if item.banned:
|
|
if item.banned:
|
|
|
- if item.banned_by_irc_user:
|
|
|
|
|
- item_ban_user = queries.get_user_name(self, item.banned_by_irc_user)
|
|
|
|
|
|
|
+ if item.banned_by_irc_user_id:
|
|
|
|
|
+ item_ban_user = queries.get_user_name(self, item.banned_by_irc_user_id)
|
|
|
else:
|
|
else:
|
|
|
- item_ban_user = item.banned_by_web_user
|
|
|
|
|
|
|
+ item_ban_user = item.banned_by_web_user_id
|
|
|
connection.privmsg(replyto, 'Created by %s on %s. Banned by %s on %s.' % (item_user, item.created, item_ban_user, item.ban_created))
|
|
connection.privmsg(replyto, 'Created by %s on %s. Banned by %s on %s.' % (item_user, item.created, item_ban_user, item.ban_created))
|
|
|
- elif command.split()[1] == 'ban':
|
|
|
|
|
|
|
+ else:
|
|
|
|
|
+ connection.privmsg(replyto, 'Created by %s on %s.' % (item_user, item.created))
|
|
|
|
|
+ elif command.split()[2] == 'ban':
|
|
|
if cmdtype == 'help':
|
|
if cmdtype == 'help':
|
|
|
- connection.privmsg(replyto, 'Bans bot from uttering %s from %s' % (command.split()[3:], command.split()[1]))
|
|
|
|
|
|
|
+ connection.privmsg(replyto, 'Bans bot from uttering %s from %s' % (command.split()[3:][0], command.split()[1]))
|
|
|
else:
|
|
else:
|
|
|
- item = queries.get_vocabulary_item(self, table_suffix, command.split()[3:])
|
|
|
|
|
|
|
+ item = queries.get_vocabulary_item(self, command.split()[1].lower(), command.split()[3:][0])
|
|
|
if not item:
|
|
if not item:
|
|
|
- connection.privmsg(replyto, '%s is not in my vocabulary.' % command.split()[3:])
|
|
|
|
|
|
|
+ connection.privmsg(replyto, '%s is not in my vocabulary.' % command.split()[3:][0])
|
|
|
else:
|
|
else:
|
|
|
- queries.ban_vocabulary_item(self, command.split()[1], user.id, item.id)
|
|
|
|
|
- connection.privmsg(replyto, '%s banned from %s' % (command.split()[3:]), commands.split()[1])
|
|
|
|
|
|
|
+ if item.banned:
|
|
|
|
|
+ connection.privmsg(replyto, '%s already banned as %s.' % (command.split()[3:][0], command.split()[1]))
|
|
|
|
|
+ else:
|
|
|
|
|
+ queries.ban_vocabulary_item(self, command.split()[1].lower(), user.id, item.id)
|
|
|
|
|
+ connection.privmsg(replyto, '%s banned as %s.' % (command.split()[3:][0], command.split()[1]))
|
|
|
else:
|
|
else:
|
|
|
- connection.privmsg(replyto, 'Invalid catagory. To list valid categories use: %s%s%s list categories' % (font.blue, self.network.command_character, one))
|
|
|
|
|
|
|
+ connection.privmsg(replyto, 'Invalid option. Options are: list info ban')
|
|
|
else:
|
|
else:
|
|
|
connection.privmsg(replyto, 'Invalid catagory. To list valid categories use: %s%s%s list categories' % (font.blue, self.network.command_character, one))
|
|
connection.privmsg(replyto, 'Invalid catagory. To list valid categories use: %s%s%s list categories' % (font.blue, self.network.command_character, one))
|
|
|
|
|
|