|
@@ -209,16 +209,18 @@ def do_command(self, connection, event):
|
|
|
return
|
|
return
|
|
|
connection.privmsg(replyto, "Display or toggle the status channel functions. Channel, function and value optional. Get a description of a functio via the help argument.")
|
|
connection.privmsg(replyto, "Display or toggle the status channel functions. Channel, function and value optional. Get a description of a functio via the help argument.")
|
|
|
connection.privmsg(replyto, grey + "Usage: " + blue + "!channelfunctions " + red + italic + "channel " + reset + italic + "function value")
|
|
connection.privmsg(replyto, grey + "Usage: " + blue + "!channelfunctions " + red + italic + "channel " + reset + italic + "function value")
|
|
|
- connection.privmsg(replyto, grey + "Usage: " + blue + "!channelfunctions help" + italic + "function")
|
|
|
|
|
|
|
+ connection.privmsg(replyto, grey + "Usage: " + blue + "!channelfunctions describe " + reset + italic + "function")
|
|
|
elif cmdtype == "cmd":
|
|
elif cmdtype == "cmd":
|
|
|
|
|
+
|
|
|
if len(command.split()) == 1: # No arguments.
|
|
if len(command.split()) == 1: # No arguments.
|
|
|
if event.target == connection.get_nickname(): # Command issued via PM.
|
|
if event.target == connection.get_nickname(): # Command issued via PM.
|
|
|
connection.privmsg(replyto, "Nothing to display, Specify a channel.")
|
|
connection.privmsg(replyto, "Nothing to display, Specify a channel.")
|
|
|
else: # Command issued as channel message.
|
|
else: # Command issued as channel message.
|
|
|
message = AH.get_channelfunctions(self, event.target)
|
|
message = AH.get_channelfunctions(self, event.target)
|
|
|
connection.privmsg(replyto, message)
|
|
connection.privmsg(replyto, message)
|
|
|
|
|
+
|
|
|
elif len(command.split()) == 2: # One argument.
|
|
elif len(command.split()) == 2: # One argument.
|
|
|
- if command.split()[1].lower() in self.channels.lower(): # Info requested on specific channel.
|
|
|
|
|
|
|
+ if command.split()[1] in self.channels: # Info requested on specific channel.
|
|
|
message = AH.get_channelfunctions(self, command.split()[1])
|
|
message = AH.get_channelfunctions(self, command.split()[1])
|
|
|
connection.privmsg(replyto, message)
|
|
connection.privmsg(replyto, message)
|
|
|
else: # First argument is not a channel the bot inhabits.
|
|
else: # First argument is not a channel the bot inhabits.
|
|
@@ -226,24 +228,26 @@ def do_command(self, connection, event):
|
|
|
connection.privmsg(replyto, command.split()[1] + " is not a channel I inhabit. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
connection.privmsg(replyto, command.split()[1] + " is not a channel I inhabit. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
|
else: # Help request.
|
|
else: # Help request.
|
|
|
connection.privmsg(replyto, "Specify a channel function to get a description of. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
connection.privmsg(replyto, "Specify a channel function to get a description of. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
|
|
|
+
|
|
|
elif len(command.split()) == 3: # Two arguments.
|
|
elif len(command.split()) == 3: # Two arguments.
|
|
|
|
|
+ channel = event.target
|
|
|
if event.target == connection.get_nickname(): # Command issued via PM.
|
|
if event.target == connection.get_nickname(): # Command issued via PM.
|
|
|
connection.privmsg(replyto, "One or three arguments required. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
connection.privmsg(replyto, "One or three arguments required. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
|
else: # Command issued via channel.
|
|
else: # Command issued via channel.
|
|
|
if not AH.is_channelfunction(command.split()[1]): # First argument is not a channelfunction.
|
|
if not AH.is_channelfunction(command.split()[1]): # First argument is not a channelfunction.
|
|
|
- if not command.split()[1].lower() == "help": # Not a help request.
|
|
|
|
|
|
|
+ if not command.split()[1].lower() == "describe": # Not a help request.
|
|
|
connection.privmsg(replyto, command.split()[1] + " is not a channel function. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
connection.privmsg(replyto, command.split()[1] + " is not a channel function. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
|
return
|
|
return
|
|
|
- if not AH.is_channelhunction(self, command.split()[2]): # Second argument not a channel function.
|
|
|
|
|
|
|
+ if not AH.is_channelfunction(command.split()[2]): # Second argument not a channel function.
|
|
|
connection.privmsg(replyto, command.split()[2] + " is not a channel function.")
|
|
connection.privmsg(replyto, command.split()[2] + " is not a channel function.")
|
|
|
return
|
|
return
|
|
|
connection.privmsg(replyto, AH.describe_channelfunction(command.split()[2]))
|
|
connection.privmsg(replyto, AH.describe_channelfunction(command.split()[2]))
|
|
|
return
|
|
return
|
|
|
# Second argument unsupported.
|
|
# Second argument unsupported.
|
|
|
if not command.split()[2].lower() in ["on", "off"]:
|
|
if not command.split()[2].lower() in ["on", "off"]:
|
|
|
- if not command.split()[1].lower() == "aggressiveness":
|
|
|
|
|
- if not AH.is_aggressiveness(command.split()[2]): # Is not an aggressiveness setting.
|
|
|
|
|
- connection.privmsg(replyto, command.split()[2] + " is not an aggressiveness setting. For help type " + blue + self.helpchat + "channelfunctions" + reset + ".")
|
|
|
|
|
|
|
+ if command.split()[1].lower() == "aggressiveness":
|
|
|
|
|
+ if not AH.is_aggressiveness(command.split()[2].lower()): # Is not an aggressiveness setting.
|
|
|
|
|
+ connection.privmsg(replyto, command.split()[2] + " is not an aggressiveness setting. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
|
return
|
|
return
|
|
|
else: # Channel function is not aggresiveness.
|
|
else: # Channel function is not aggresiveness.
|
|
|
connection.privmsg(replyto, "The value of this channel function can only be \"on\" or \"off\". For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
connection.privmsg(replyto, "The value of this channel function can only be \"on\" or \"off\". For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
@@ -254,6 +258,7 @@ def do_command(self, connection, event):
|
|
|
if command.split()[1].lower() == "autojoin" and event.target == self.homechannel: # Chaning autojoin of homechannel.
|
|
if command.split()[1].lower() == "autojoin" and event.target == self.homechannel: # Chaning autojoin of homechannel.
|
|
|
connection.action(replyto, "will always join it's homechannel " + red + self.homechannel + reset + ", regardless of the autojoin function.")
|
|
connection.action(replyto, "will always join it's homechannel " + red + self.homechannel + reset + ", regardless of the autojoin function.")
|
|
|
self.db.run("UPDATE channels SET " + command.split()[1].lower() + "='" + command.split()[2].lower() + "' WHERE name='" + event.target + "' AND network='" + self.network + "'")
|
|
self.db.run("UPDATE channels SET " + command.split()[1].lower() + "='" + command.split()[2].lower() + "' WHERE name='" + event.target + "' AND network='" + self.network + "'")
|
|
|
|
|
+
|
|
|
elif len(command.split()) == 4: # Three arguments.
|
|
elif len(command.split()) == 4: # Three arguments.
|
|
|
if not command.split()[1] in self.channels: # Bot does not inhabit channel to be altered.
|
|
if not command.split()[1] in self.channels: # Bot does not inhabit channel to be altered.
|
|
|
connection.privmsg(replyto, command.split()[1] + " is not a channel I inhabit. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
connection.privmsg(replyto, command.split()[1] + " is not a channel I inhabit. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|