common.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import random
  2. from datetime import datetime
  3. from common import queries, userstatus, log
  4. class Inform():
  5. def owners(self, connection, message):
  6. log.info('Informing owners: %s' % message)
  7. if self.network.home_channel in self.channels:
  8. for owner in self.channels[self.network.home_channel].owners():
  9. connection.privmsg(owner, message)
  10. def notice_owners(self, connection, message):
  11. log.info('Notifying owners: %s' % message)
  12. if self.network.home_channel in self.channels:
  13. for owner in self.channels[self.network.home_channel].owners():
  14. connection.notice(owner, message)
  15. def operators(self, connection, message):
  16. log.info('Informing operators: %s' % message)
  17. if self.network.home_channel in self.channels:
  18. for user in self.channels[self.network.home_channel].owners():
  19. connection.privmsg(user, message)
  20. for user in self.channels[self.network.home_channel].admins():
  21. connection.privmsg(user, message)
  22. for user in self.channels[self.network.home_channel].opers():
  23. connection.privmsg(user, message)
  24. def home_channel(self, connection, message):
  25. log.info('Informing home channel: %s' % message)
  26. connection.privmsg(self.network.home_channel, message)
  27. class Replyto():
  28. def name(self, connection, replyto):
  29. # Reply with a random message or action.
  30. if random.randint(0, 1) == 0:
  31. message = queries.random_nick_reply_message(self)
  32. if message:
  33. connection.privmsg(replyto, message)
  34. else:
  35. action = queries.random_nick_reply_action(self)
  36. if action:
  37. connection.action(replyto, action)
  38. # messages = [
  39. # "Hello " + event.source.nick + ".",
  40. # "How are you today " + event.source.nick + "?",
  41. # "Piss off " + event.source.nick + "!",
  42. # event.source.nick + ", what are you botherring me for?",
  43. # "Go bother someone else...",
  44. # "Is life treating you fair?",
  45. # "What's up?",
  46. # "Why are you talking to me?",
  47. # "I'm not talking to you!",
  48. # "What have you been up to?",
  49. # "How is life?",
  50. # "What do you want from me?",
  51. # event.source.nick + ", why are you bothering me?",
  52. # event.source.nick + ", when will you stop talking about me?",
  53. # event.source.nick + " I hate you!",
  54. # "Get bent!",
  55. # "Go and cut yourself.",
  56. # "Do you think i care about you?",
  57. # "Stop nickalerting me " + event.source.nick + ", you wanker!",
  58. # ]
  59. # actions = [
  60. # "hides!",
  61. # "dies.",
  62. # "runs away.",
  63. # "is ignoring that.",
  64. # "is not feeling like caring.",
  65. # "is away",
  66. # "will be ignoring that.",
  67. # "is faggaliciouz!! <333",
  68. # "likes you! <3",
  69. # "looks the other way...",
  70. # "does a little dance with " + event.source.nick + ".",
  71. # "makes a little love.",
  72. # "get's down tonight.",
  73. # "thinks SAM Broadcaster sucks raw cocks in hell!",
  74. # "is secretly in love with " + event.source.nick + ".",
  75. # "tosses " + event.source.nick + "'s salad.",
  76. # "tortures " + event.source.nick + " horribly!",
  77. # "is smelling like tuna when looking at " + event.source.nick + ".",
  78. # "sniffing armpits.. Eew! Smells like " + event.source.nick + ".",
  79. # "rapes " + event.source.nick + ".",
  80. # "pets " + event.source.nick + ", and sais: Why what a nice little human you are, and such plentifull organs!"
  81. # ]
  82. # class Protectees():
  83. # def update(self, nick, user, host):
  84. # if nick in self.protectees: # On record.
  85. # if userstatus.atleast_halfop(self, user, self.network.home_channel) or nick == self.connection.get_nickname(): # Update. Is atleast halfop or bot itself.
  86. # self.protectees[nick].update({'ident': nick + "!" + user + "@" + host})
  87. # else: # Delete.
  88. # del self.protectees[nick]
  89. # else: # Append.
  90. # if userstatus.atleast_halfop(self, user, self.network.home_channel) or nick == self.connection.get_nickname(): # Update. Is atleast halfop or bot itself.
  91. # self.protectees[nick] = {'ident': nick + "!" + user + "@" + host}
  92. # class Aggressiveness():
  93. # def retalliation_reason(self, connection, protectee, behaviour):
  94. # if protectee == connection.get_nickname(): # Bot itself.
  95. # return "Aggression channel function = " + behaviour + ": Self defense."
  96. # else:
  97. # return "Aggression channel function = " + behaviour + ": " + protectee + " is atlast halfop in " + self.network.home_channel + "."
  98. #