1
0

on_privmsg.py 1.1 KB

1234567891011121314151617181920
  1. import commands.public, commands.admin, commands.games, commands.statistics, commands.chat
  2. from common import log, queries, font
  3. from events.common import Inform
  4. def process_event(self, connection, event):
  5. log.info(event) # Log to console.
  6. # Get and update resources.
  7. user = queries.create_or_get_and_update_last_event(self, 'user', 'pm', user_name=event.source.nick, event_subject_name=event.target)
  8. channel = None
  9. if not event.source.nick == connection.get_nickname(): # Message is not from myself.
  10. Inform.owners(self, connection, 'PM from %s%s%s: %s%s' % (font.red, event.source.nick, font.grey, font.green, event.arguments[0])) # Forward message to users with owner rights of home channel.
  11. # Respond to commands.
  12. commands.public.do_command(self, connection, event, user, channel)
  13. commands.games.do_command(self, connection, event, user, channel)
  14. commands.statistics.do_command(self, connection, event, user, channel)
  15. commands.chat.do_command(self, connection, event, user, channel)
  16. commands.admin.do_command(self, connection, event, user, channel)