forked from minetest-mods/irc
Add a confirmation message to /irc_msg and fix a few bugs
This commit is contained in:
parent
7183e96a40
commit
44cb68227f
@ -22,16 +22,15 @@ minetest.register_chatcommand("irc_msg", {
|
|||||||
minetest.chat_send_player(name, "IRC: You are not connected, use /irc_connect.");
|
minetest.chat_send_player(name, "IRC: You are not connected, use /irc_connect.");
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
local pos = param:find(" ", 1, true);
|
local found, _, toname, msg = param:find("^([^%s#]+)%s(.+)");
|
||||||
if (not pos) then return; end
|
if not found then
|
||||||
local name = param:sub(1, pos - 1);
|
minetest.chat_send_player(name, "Invalid usage, see /help irc_msg.");
|
||||||
local msg = param:sub(pos + 1);
|
return;
|
||||||
local t = {
|
end
|
||||||
name=name;
|
local t = {name=name, message=msg};
|
||||||
message=msg;
|
|
||||||
};
|
|
||||||
local text = mt_irc.message_format_out:expandvars(t);
|
local text = mt_irc.message_format_out:expandvars(t);
|
||||||
irc.send("PRIVMSG", name, text);
|
mt_irc.say(toname, text);
|
||||||
|
minetest.chat_send_player(name, "Message sent!")
|
||||||
end;
|
end;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user