mirror of
https://github.com/minetest-mods/irc.git
synced 2024-11-05 09:40:20 +01:00
Change the >playername private message syntax to @playername and add a confirmation message
This commit is contained in:
parent
44cb68227f
commit
63c2b52c41
|
@ -92,7 +92,7 @@ irc.register_callback("private_msg", function ( from, message )
|
||||||
if (not mt_irc.connect_ok) then return; end
|
if (not mt_irc.connect_ok) then return; end
|
||||||
local player_to;
|
local player_to;
|
||||||
local msg;
|
local msg;
|
||||||
if (message:sub(1, 1) == ">") then
|
if (message:sub(1, 1) == "@") then
|
||||||
local pos = message:find(" ", 1, true);
|
local pos = message:find(" ", 1, true);
|
||||||
if (not pos) then return; end
|
if (not pos) then return; end
|
||||||
player_to = message:sub(2, pos - 1);
|
player_to = message:sub(2, pos - 1);
|
||||||
|
@ -102,7 +102,7 @@ irc.register_callback("private_msg", function ( from, message )
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
irc.say(from, 'Message not sent! Please use "!help" to see possible commands.');
|
irc.say(from, 'Message not sent! Please use "!help" to see possible commands.');
|
||||||
irc.say(from, ' Or use the ">playername Message" syntax to send a private message.');
|
irc.say(from, ' Or use the "@playername Message" syntax to send a private message.');
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
if (not mt_irc.connected_players[player_to]) then
|
if (not mt_irc.connected_players[player_to]) then
|
||||||
|
@ -119,6 +119,7 @@ irc.register_callback("private_msg", function ( from, message )
|
||||||
local text = mt_irc.message_format_in:expandvars(t);
|
local text = mt_irc.message_format_in:expandvars(t);
|
||||||
if (mt_irc._callback("private_msg", from, player_to, message, text)) then return; end
|
if (mt_irc._callback("private_msg", from, player_to, message, text)) then return; end
|
||||||
minetest.chat_send_player(player_to, "PRIVATE: "..text);
|
minetest.chat_send_player(player_to, "PRIVATE: "..text);
|
||||||
|
mt_irc.say(from, "Message sent!")
|
||||||
end);
|
end);
|
||||||
|
|
||||||
irc.register_callback("kick", function(chaninfo, nick, kicker)
|
irc.register_callback("kick", function(chaninfo, nick, kicker)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user