|
@@ -23,9 +23,13 @@ def process_event(self, connection, event):
|
|
|
self.db.run("UPDATE \"users\" SET actions=actions+1 WHERE name='" + event.source.nick + "' AND network='" + self.network + "'") # Increment record.
|
|
self.db.run("UPDATE \"users\" SET actions=actions+1 WHERE name='" + event.source.nick + "' AND network='" + self.network + "'") # Increment record.
|
|
|
|
|
|
|
|
# Slap guard.
|
|
# Slap guard.
|
|
|
- if not self.db.one("SELECT chat FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'"):
|
|
|
|
|
- return # Stop if chat channel function is off.
|
|
|
|
|
if event.arguments[0].lower().startswith("slaps ") and not event.target == connection.get_nickname(): # Channel action that stats with "slaps ".
|
|
if event.arguments[0].lower().startswith("slaps ") and not event.target == connection.get_nickname(): # Channel action that stats with "slaps ".
|
|
|
|
|
+
|
|
|
|
|
+ # Stop if chat channel function is off.
|
|
|
|
|
+ if not self.db.one("SELECT chat FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'"):
|
|
|
|
|
+ return
|
|
|
|
|
+
|
|
|
|
|
+ # Only protect the worty.
|
|
|
if not userstatus.atleast_voiced(self, event.arguments[0].split(" ")[1], self.homechannel) and not userstatus.atleast_oper(self, event.arguments[0].split(" ")[1], self.homechannel): # Insufficient rights.
|
|
if not userstatus.atleast_voiced(self, event.arguments[0].split(" ")[1], self.homechannel) and not userstatus.atleast_oper(self, event.arguments[0].split(" ")[1], self.homechannel): # Insufficient rights.
|
|
|
return
|
|
return
|
|
|
if userstatus.atleast_voiced(self, event.source.nick, self.homechannel): # Slapper has atleast voice in home channel.
|
|
if userstatus.atleast_voiced(self, event.source.nick, self.homechannel): # Slapper has atleast voice in home channel.
|
|
@@ -33,12 +37,20 @@ def process_event(self, connection, event):
|
|
|
return
|
|
return
|
|
|
if self.channels[self.homechannel].is_owner(event.source.nick) and self.channels[self.homechannel].is_owner(event.arguments[0].split(" ")[1]): # Slapper and slappee are owner.
|
|
if self.channels[self.homechannel].is_owner(event.source.nick) and self.channels[self.homechannel].is_owner(event.arguments[0].split(" ")[1]): # Slapper and slappee are owner.
|
|
|
return
|
|
return
|
|
|
-
|
|
|
|
|
|
|
+ # Respond.
|
|
|
if " with a " in event.arguments[0]:
|
|
if " with a " in event.arguments[0]:
|
|
|
if event.arguments[0].split(" with a ", maxsplit=1)[1]:
|
|
if event.arguments[0].split(" with a ", maxsplit=1)[1]:
|
|
|
- connection.action(event.target, "swiftly jumps in front of " + red + event.arguments[0].split(" ")[1] + reset + " to block the " + event.arguments[0].split(" with a ", maxsplit=1)[1])
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ if event.arguments[0].split(" ")[1].lower() == self.get_nickname(): # Bot slapped
|
|
|
|
|
+ connection.action(event.target, "Takes the " + event.arguments[0].split(" with a ", maxsplit=1)[1] + " like a robot.")
|
|
|
|
|
+ else:
|
|
|
|
|
+ connection.action(event.target, "swiftly jumps in front of " + red + event.arguments[0].split(" ")[1] + reset + " to block the " + event.arguments[0].split(" with a ", maxsplit=1)[1])
|
|
|
|
|
|
|
|
- connection.action(event.target, "swiftly jumps in front of " + red + event.arguments[0].split(" ")[1] + reset + " to block the slap.")
|
|
|
|
|
|
|
+ elif event.arguments[0].split(" ")[1].lower() == self.get_nickname(): # Bot slapped
|
|
|
|
|
+ connection.action(event.target, "bites " + red + event.source.nick + reset + " furiously.")
|
|
|
|
|
+ else:
|
|
|
|
|
+ connection.action(event.target, "swiftly jumps in front of " + red + event.arguments[0].split(" ")[1] + reset + " to block the slap.")
|
|
|
elif len(event.arguments[0].split(" ")) > 1:
|
|
elif len(event.arguments[0].split(" ")) > 1:
|
|
|
- connection.action(event.target, "swiftly jumps in front of " + red + event.arguments[0].split(" ")[1] + reset + " to block the slap.")
|
|
|
|
|
|
|
+ if event.arguments[0].split(" ")[1].lower() == self.get_nickname(): # Bot slapped
|
|
|
|
|
+ connection.action(event.target, "bites " + red + event.source.nick + reset + " furiously.")
|
|
|
|
|
+ else:
|
|
|
|
|
+ connection.action(event.target, "swiftly jumps in front of " + red + event.arguments[0].split(" ")[1] + reset + " to block the slap.")
|