1
0
mirror of https://github.com/minetest-mods/irc.git synced 2024-11-05 09:40:20 +01:00

Add support for configurable coloring of IRC messages in-game

IRC channel messages are colored green by default
IRC PMs are colored purple by default
This commit is contained in:
Anand S 2018-09-09 21:38:02 +05:30 committed by sofar
parent c9c57a6f93
commit b4fbccd64a
4 changed files with 8 additions and 5 deletions

View File

@ -51,7 +51,8 @@ function irc.bot_command(msg, text)
return
end
minetest.chat_send_player(player_to,
"PM from "..msg.user.nick.."@IRC: "..message, false)
minetest.colorize(irc.config.pm_color,
"PM from "..msg.user.nick.."@IRC: "..message, false))
irc.reply("Message sent!")
return
end

View File

@ -23,7 +23,7 @@ local function setting(stype, name, default, required)
value = minetest.setting_get("irc."..name)
elseif stype == "number" then
value = tonumber(minetest.setting_get("irc."..name))
end
end
end
if value == nil then
if required then
@ -65,4 +65,5 @@ setting("bool", "debug", false) -- Enable debug output
setting("bool", "enable_player_part", true) -- Whether to enable players joining and parting the channel
setting("bool", "auto_join", true) -- Whether to automatically show players in the channel when they join
setting("bool", "auto_connect", true) -- Whether to automatically connect to the server on mod load
setting("string", "chat_color", "#339933") -- Color of IRC chat in-game, green by default
setting("string", "pm_color", "#8800AA") -- Color of IRC PMs in-game, purple by default

View File

@ -8,7 +8,7 @@ function irc.logChat(message)
end
function irc.sendLocal(message)
minetest.chat_send_all(message)
minetest.chat_send_all(minetest.colorize(irc.config.chat_color, message))
irc.logChat(message)
end

View File

@ -63,7 +63,8 @@ end)
function irc.sendLocal(message)
for name, _ in pairs(irc.joined_players) do
minetest.chat_send_player(name, message)
minetest.chat_send_player(name,
minetest.colorize(irc.config.chat_color, message))
end
irc.logChat(message)
end