#!/usr/bin/env python # file covert_agent.py # author Florent Guiotte # version 0.1 # date 16 avril 2020 """ Place this file here (╯°□°)╯︵ ~/.config/hexchat/addons """ import hexchat import re __module_name__ = 'CovertAgent' __module_version__ = '0.1' __module_description__ = 'Display nicknames through discord bridge' BRIDGE_NAME = 'CovertAgent' edited = False def parse_nick(word, word_eol, userdata): global edited if edited: return nick = word[0] if not BRIDGE_NAME in nick: return hexchat.EAT_NONE ca_nick = re.search('<.*?>', word[1]).group().strip('<>') new_msg = re.sub('<.*?> ', '', word[1]) new_nick = '► {}'.format(ca_nick) word[0] = new_nick word[1] = new_msg edited = True hexchat.emit_print(userdata, *word) edited = False return hexchat.EAT_ALL hexchat.hook_print('Channel Message', parse_nick, 'Channel Message', priority=hexchat.PRI_HIGHEST)