PYTHON   78

hexbot py

Guest on 21st June 2022 05:49:47 PM

  1. __module_name__ = "artifexirc-bot rewriter"
  2. __module_version__ = "1.0"
  3. __module_description__ = "Rewrite username from artifexirc-bot messages."
  4.  
  5. import hexchat
  6.  
  7. halt = False
  8.  
  9. def on_channel_message(word, word_eol, event, attrs):
  10.         global halt
  11.         if halt is True:
  12.                 return
  13.         if word[0] == 'artifexirc-bot' or word[0] == 'artifexi-':
  14.                 list = word[1].split(" ")
  15.                 user = list[0]
  16.                 if user[0] == '<' and user[-1] == '>':
  17.                         user = "\u00bb " + user[1:-1]
  18.                         message = " ".join(list[1:])
  19.                         halt = True
  20.                         hexchat.emit_print(event, user, message)
  21.                         halt = False
  22.                         return hexchat.EAT_ALL
  23.  
  24.  
  25. hooks = [ "Channel Message", "Channel Msg Hilight", "Channel Action", "Channel Action Hilight" ]
  26. for hook in hooks:
  27.         hexchat.hook_print_attrs(hook, on_channel_message, hook, hexchat.PRI_HIGH)

Raw Paste


Login or Register to edit or fork this paste. It's free.