forked from minetest-mods/irc
Fixed /me Actions from the channel not showing in-game
This commit is contained in:
parent
4baafeec46
commit
4386b9bbd2
@ -11,7 +11,8 @@ Version 0.1.2:
|
|||||||
- Added automatic reconnection in case the bot is kicked from the
|
- Added automatic reconnection in case the bot is kicked from the
|
||||||
channel.
|
channel.
|
||||||
- Fixed delay while the bot waits for the Message Of The Day (or topic)
|
- Fixed delay while the bot waits for the Message Of The Day (or topic)
|
||||||
- Added automatic reconnection in case of ping timeout.
|
- Fixed bug where players were able to send messages to the channel
|
||||||
|
even if they had no `shout' priv.
|
||||||
|
|
||||||
Version 0.1.1:
|
Version 0.1.1:
|
||||||
- Moved all user configuration to `config.lua'.
|
- Moved all user configuration to `config.lua'.
|
||||||
|
@ -105,6 +105,13 @@ irc.register_callback("nick_change", function ( from, old_nick )
|
|||||||
if (not mt_irc.connect_ok) then return; end
|
if (not mt_irc.connect_ok) then return; end
|
||||||
end);
|
end);
|
||||||
|
|
||||||
|
irc.register_callback("channel_act", function ( servinfo, from, message)
|
||||||
|
local text = "*** "..from.." "..message;
|
||||||
|
for k, v in pairs(mt_irc.connected_players) do
|
||||||
|
if (v) then minetest.chat_send_player(k, text); end
|
||||||
|
end
|
||||||
|
end);
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function ( player )
|
minetest.register_on_leaveplayer(function ( player )
|
||||||
local name = player:get_player_name();
|
local name = player:get_player_name();
|
||||||
mt_irc.connected_players[name] = false;
|
mt_irc.connected_players[name] = false;
|
||||||
@ -115,14 +122,8 @@ end);
|
|||||||
minetest.register_on_chat_message(function ( name, message )
|
minetest.register_on_chat_message(function ( name, message )
|
||||||
if (not mt_irc.connect_ok) then return; end
|
if (not mt_irc.connect_ok) then return; end
|
||||||
if (message:sub(1, 1) == "/") then return; end
|
if (message:sub(1, 1) == "/") then return; end
|
||||||
if (not mt_irc.connected_players[name]) then
|
if (not mt_irc.connected_players[name]) then return; end
|
||||||
--minetest.chat_send_player(name, "IRC: You are not connected. Please use /join");
|
if (not minetest.check_player_privs(name, {shout=true})) then
|
||||||
return;
|
|
||||||
end
|
|
||||||
local privs = minetest.get_player_privs(name);
|
|
||||||
if (not privs.shout) then
|
|
||||||
minetest.chat_send_player(name, "IRC: No shout priv");
|
|
||||||
irc.say(mt_irc.channel, "DEBUG: message from unpriviledged player: "..name);
|
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
if (not mt_irc.buffered_messages) then
|
if (not mt_irc.buffered_messages) then
|
||||||
@ -142,7 +143,9 @@ minetest.register_on_shutdown(function ( )
|
|||||||
end);
|
end);
|
||||||
|
|
||||||
irc.handlers.on_error = function (from, respond_to)
|
irc.handlers.on_error = function (from, respond_to)
|
||||||
minetest.chat_send_all("IRC: Ping timeout. Reconnecting bot in 5 seconds...");
|
for k, v in pairs(mt_irc.connected_players) do
|
||||||
|
if (v) then minetest.chat_send_player(k, text); end
|
||||||
|
end
|
||||||
mt_irc.got_motd = false;
|
mt_irc.got_motd = false;
|
||||||
mt_irc.connect_ok = false;
|
mt_irc.connect_ok = false;
|
||||||
irc.quit("Ping timeout");
|
irc.quit("Ping timeout");
|
||||||
|
Loading…
Reference in New Issue
Block a user