| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- from common import queries #userstatus, font, queries
- #from events.common import Replyto, Lastact, MessageStatistics
- def process_event(self, connection, event):
- # Let's not log all actions.
- # Get and update resources.
- user = queries.create_or_get_and_update_last_event(self, 'user', 'ca', channel_name=event.target, user_name=event.source.nick)
- if event.target != connection.get_nickname(): # Channel action.
- channel = queries.create_or_get_and_update_last_event(self, 'channel', 'ca', channel_name=event.target, user_name=event.source.nick)
- queries.update_message_statistics(self, 'message', channel.id, user.id) # Update message statistics
- # # Stop if channelfunction chat if off.
- # if not self.db.one("SELECT chat FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'"):
- # return
- #
- # # Slap guard.
- # 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 event.arguments[0].split(" ")[1].lower() == connection.get_nickname(): # Bot slapped
- # Replyto.name(connection, event)
- # return
- # if userstatus.atleast_voiced(self, event.source.nick, self.homechannel): # Slapper has atleast voice in home channel.
- # if not self.channels[self.homechannel].is_owner(event.arguments[0].split(" ")[1]): # Slappee is not owner.
- # if event.arguments[0].split(" ")[1].lower() == connection.get_nickname(): # Bot slapped
- # Replyto.name(connection, event)
- # 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 event.arguments[0].split(" ")[1].lower() == connection.get_nickname(): # Bot slapped
- # Replyto.name(connection, event)
- # return
- #
- # # Respond.
- # if " with a " in event.arguments[0]:
- # if event.arguments[0].split(" with a ", maxsplit=1)[1]:
- # if event.arguments[0].split(" ")[1].lower() == connection.get_nickname().lower(): # 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])
- #
- # elif event.arguments[0].split(" ")[1].lower() == connection.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:
- # if event.arguments[0].split(" ")[1].lower() == connection.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.")
- #
- # # Respond to own name.
- # elif connection.get_nickname().lower() in event.arguments[0].lower() and event.source.nick is not connection.get_nickname(): # Bot's name was mentioned, not by the bot itself.
- # Replyto.name(connection, event)
|