1
0

on_action.py 4.1 KB

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