mirror of
https://github.com/minetest-mods/irc.git
synced 2024-12-28 01:30:21 +01:00
Add "[off]" prefix for messages not to be sent to the "other side".
If an in-game message begins with "[off]", it's not sent to IRC, and vice-versa.
This commit is contained in:
parent
aa299b7a10
commit
10f32b77b0
@ -109,6 +109,9 @@ Once the game is connected to the IRC channel, chatting using the 'T' or
|
|||||||
by anyone. Also, when someone sends a message to the channel, that text
|
by anyone. Also, when someone sends a message to the channel, that text
|
||||||
will be visible in-game.
|
will be visible in-game.
|
||||||
|
|
||||||
|
Messages that begin with "[off]" from in-game or IRC are not sent to the
|
||||||
|
other side.
|
||||||
|
|
||||||
This mod also adds a few chat commands:
|
This mod also adds a few chat commands:
|
||||||
|
|
||||||
/irc_msg <nick> <message>
|
/irc_msg <nick> <message>
|
||||||
|
@ -21,6 +21,7 @@ end)
|
|||||||
minetest.register_on_chat_message(function(name, message)
|
minetest.register_on_chat_message(function(name, message)
|
||||||
if not mt_irc.connected
|
if not mt_irc.connected
|
||||||
or message:sub(1, 1) == "/"
|
or message:sub(1, 1) == "/"
|
||||||
|
or message:sub(1, 5) == "[off]"
|
||||||
or not mt_irc.joined_players[name]
|
or not mt_irc.joined_players[name]
|
||||||
or (not minetest.check_player_privs(name, {shout=true})) then
|
or (not minetest.check_player_privs(name, {shout=true})) then
|
||||||
return
|
return
|
||||||
|
@ -109,6 +109,8 @@ function mt_irc.hooks.channelChat(user, channel, message)
|
|||||||
|
|
||||||
if mt_irc:check_botcmd(user, channel, message) then
|
if mt_irc:check_botcmd(user, channel, message) then
|
||||||
return
|
return
|
||||||
|
elseif message:sub(1, 5) == "[off]" then
|
||||||
|
return
|
||||||
elseif foundchat then
|
elseif foundchat then
|
||||||
mt_irc:sendLocal(("<%s@%s> %s")
|
mt_irc:sendLocal(("<%s@%s> %s")
|
||||||
:format(chatnick, user.nick, chatmessage))
|
:format(chatnick, user.nick, chatmessage))
|
||||||
|
Loading…
Reference in New Issue
Block a user