on_action.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. from common import queries #userstatus, font, queries
  2. #from events.common import Replyto, Lastact, MessageStatistics
  3. def process_event(self, connection, event):
  4. # Let's not log all actions.
  5. if event.target != connection.get_nickname(): # Channel action.
  6. channel = queries.create_or_get_and_update_last_event(self, 'channel', 'ca', channel_name=event.target, user_name=event.source.nick)
  7. user = queries.create_or_get_and_update_last_event(self, 'user', 'ca', channel_name=event.target, user_name=event.source.nick)
  8. # # Stop if channelfunction chat if off.
  9. # if not self.db.one("SELECT chat FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'"):
  10. # return
  11. #
  12. # # Slap guard.
  13. # if event.arguments[0].lower().startswith("slaps ") and not event.target == connection.get_nickname(): # Channel action that stats with "slaps ".
  14. #
  15. # # Stop if chat channel function is off.
  16. # if not self.db.one("SELECT chat FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'"):
  17. # return
  18. #
  19. # # Only protect the worty.
  20. # 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.
  21. # if event.arguments[0].split(" ")[1].lower() == connection.get_nickname(): # Bot slapped
  22. # Replyto.name(connection, event)
  23. # return
  24. # if userstatus.atleast_voiced(self, event.source.nick, self.homechannel): # Slapper has atleast voice in home channel.
  25. # if not self.channels[self.homechannel].is_owner(event.arguments[0].split(" ")[1]): # Slappee is not owner.
  26. # if event.arguments[0].split(" ")[1].lower() == connection.get_nickname(): # Bot slapped
  27. # Replyto.name(connection, event)
  28. # return
  29. # 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.
  30. # if event.arguments[0].split(" ")[1].lower() == connection.get_nickname(): # Bot slapped
  31. # Replyto.name(connection, event)
  32. # return
  33. #
  34. # # Respond.
  35. # if " with a " in event.arguments[0]:
  36. # if event.arguments[0].split(" with a ", maxsplit=1)[1]:
  37. # if event.arguments[0].split(" ")[1].lower() == connection.get_nickname().lower(): # Bot slapped
  38. # connection.action(event.target, "Takes the " + event.arguments[0].split(" with a ", maxsplit=1)[1] + " like a robot.")
  39. # else:
  40. # 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])
  41. #
  42. # elif event.arguments[0].split(" ")[1].lower() == connection.get_nickname(): # Bot slapped
  43. # connection.action(event.target, "bites " + red + event.source.nick + reset + " furiously.")
  44. # else:
  45. # connection.action(event.target, "swiftly jumps in front of " + red + event.arguments[0].split(" ")[1] + reset + " to block the slap.")
  46. # elif len(event.arguments[0].split(" ")) > 1:
  47. # if event.arguments[0].split(" ")[1].lower() == connection.get_nickname(): # Bot slapped
  48. # connection.action(event.target, "bites " + red + event.source.nick + reset + " furiously.")
  49. # else:
  50. # connection.action(event.target, "swiftly jumps in front of " + red + event.arguments[0].split(" ")[1] + reset + " to block the slap.")
  51. #
  52. # # Respond to own name.
  53. # 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.
  54. # Replyto.name(connection, event)