forked from matpow2/pyspades-userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
teamchat.py
19 lines (18 loc) · 804 Bytes
/
teamchat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# teamchat.py
# Shows team chat in IRC, colored appropriately.
# by topologist
def apply_script(protocol, connection, config):
class TeamChatConnection(connection):
def on_chat(self, value, is_global):
if is_global or not self.protocol.irc_relay:
return connection.on_chat(self, value, is_global)
if self.team == self.protocol.blue_team:
message = '<\x0302'
elif self.team == self.protocol.green_team:
message = '<\x0303'
else:
message = '<\x0307'
message += '%s%s> %s' % (self.name, '\x03', value)
self.protocol.irc_relay.send(message, filter = False)
return connection.on_chat(self, value, is_global)
return protocol, TeamChatConnection