Add covert agent
This commit is contained in:
parent
5cb94acbe1
commit
b76f3b7923
43
covert_agent.py
Normal file
43
covert_agent.py
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
# file covert_agent.py
|
||||
# author Florent Guiotte <florent.guiotte@irisa.fr>
|
||||
# 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)
|
Loading…
Reference in New Issue
Block a user