get some themerelated colors from settings
parent
8ac7aa1c4b
commit
d4724a8090
15
hooks.lua
15
hooks.lua
|
@ -11,6 +11,9 @@ irc.registered_hooks = {}
|
||||||
|
|
||||||
local stripped_chars = "[\2\31]"
|
local stripped_chars = "[\2\31]"
|
||||||
|
|
||||||
|
local failure = minetest.setting_get("color_failure")
|
||||||
|
local important = minetest.setting_get("color_important")
|
||||||
|
|
||||||
local function normalize(text)
|
local function normalize(text)
|
||||||
-- Strip colors
|
-- Strip colors
|
||||||
text = text:gsub("\3[0-9][0-9,]*", "")
|
text = text:gsub("\3[0-9][0-9,]*", "")
|
||||||
|
@ -128,10 +131,10 @@ function irc.hooks.channelChat(msg)
|
||||||
irc.sendLocal(("<%s"..core.colorize("#A3B5CB","@%s").."> %s")
|
irc.sendLocal(("<%s"..core.colorize("#A3B5CB","@%s").."> %s")
|
||||||
:format(chatnick, msg.user.nick, chatmessage))
|
:format(chatnick, msg.user.nick, chatmessage))
|
||||||
elseif foundjoin then
|
elseif foundjoin then
|
||||||
irc.sendLocal((core.colorize("#4ec44e", "➡ ")..core.colorize("#a74ec4", " %s")..core.colorize("#c44eb5"," just joined %s!"))
|
irc.sendLocal((core.colorize("#4ec44e", "➡ ")..core.colorize(failure, " %s")..core.colorize(important," just joined %s!"))
|
||||||
:format(joinnick, msg.user.nick))
|
:format(joinnick, msg.user.nick))
|
||||||
elseif foundleave then
|
elseif foundleave then
|
||||||
irc.sendLocal((core.colorize("#c44e4e", "⬅ ")..core.colorize("#a74ec4", " %s")..core.colorize("#c44eb5"," just left %s... ."))
|
irc.sendLocal((core.colorize("#c44e4e", "⬅ ")..core.colorize(failure, " %s")..core.colorize(important," just left %s... ."))
|
||||||
:format(leavenick, msg.user.nick))
|
:format(leavenick, msg.user.nick))
|
||||||
elseif foundaction then
|
elseif foundaction then
|
||||||
irc.sendLocal(("* %s"..core.colorize("#A3B5CB","@%s").." %s")
|
irc.sendLocal(("* %s"..core.colorize("#A3B5CB","@%s").." %s")
|
||||||
|
@ -187,26 +190,26 @@ end
|
||||||
|
|
||||||
|
|
||||||
function irc.hooks.nick(user, newNick)
|
function irc.hooks.nick(user, newNick)
|
||||||
irc.sendLocal((core.colorize("#c44eb5", "-!-")..core.colorize("#a74ec4", " %s")..core.colorize("#c44eb5"," is now known as")..core.colorize("#a74ec4", " %s"))
|
irc.sendLocal((core.colorize("#c44eb5", "-!-")..core.colorize(failure, " %s")..core.colorize(important," is now known as")..core.colorize(failure, " %s"))
|
||||||
:format(user.nick, newNick))
|
:format(user.nick, newNick))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function irc.hooks.join(user, channel)
|
function irc.hooks.join(user, channel)
|
||||||
irc.sendLocal((core.colorize("#4ec44e", "-!-")..core.colorize("#a74ec4", " %s")..core.colorize("#c44eb5"," joined %s"))
|
irc.sendLocal((core.colorize("#4ec44e", "-!-")..core.colorize(failure, " %s")..core.colorize(important," joined %s"))
|
||||||
:format(user.nick, channel))
|
:format(user.nick, channel))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function irc.hooks.part(user, channel, reason)
|
function irc.hooks.part(user, channel, reason)
|
||||||
reason = reason or ""
|
reason = reason or ""
|
||||||
irc.sendLocal((core.colorize("#c44e4e", "-!-")..core.colorize("#a74ec4", " %s")..core.colorize("#c44eb5"," has left %s [%s]"))
|
irc.sendLocal((core.colorize("#c44e4e", "-!-")..core.colorize(failure, " %s")..core.colorize(important," has left %s [%s]"))
|
||||||
:format(user.nick, channel, reason))
|
:format(user.nick, channel, reason))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function irc.hooks.quit(user, reason)
|
function irc.hooks.quit(user, reason)
|
||||||
irc.sendLocal((core.colorize("#c44e4e", "-!-")..core.colorize("#a74ec4", " %s")..core.colorize("#c44eb5"," has quit [%s]"))
|
irc.sendLocal((core.colorize("#c44e4e", "-!-")..core.colorize(failure, " %s")..core.colorize(important," has quit [%s]"))
|
||||||
:format(user.nick, reason))
|
:format(user.nick, reason))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue