-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathinit.lua
42 lines (34 loc) · 1008 Bytes
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
if irc then
function irc.playerMessage(name, message)
local pteam = ctf_teams.get(name)
local color = pteam and ctf_teams.team[pteam].irc_color or 16
local clear = "\x0F"
if color then
color = "\x03" .. color
else
color = ""
clear = ""
end
local abrace = color .. "<" .. clear
local bbrace = color .. ">" .. clear
return ("%s%s%s %s"):format(abrace, name, bbrace, message)
end
local old_send_me = ctf_chat.send_me
ctf_chat.send_me = function(name, message, ...)
old_send_me(name, message, ...)
local msg = irc.playerMessage(name, message)
if msg:match("^\x03%d-<") then
local start_escape = msg:sub(1, msg:find("<")-1)
-- format is: \startescape < \endescape playername \startescape > \endescape
msg = msg:gsub("\15(.-)"..start_escape, "* %1"):gsub("[<>]", "")
end
irc.say(msg)
end
local old_announce = ctf_modebase.announce
ctf_modebase.announce = function(msg)
for m in msg:gmatch("[^\n]+") do
irc.say(m)
end
old_announce(msg)
end
end