mirror of
https://github.com/minetest-mods/irc.git
synced 2024-12-30 18:40:19 +01:00
Testing
This commit is contained in:
parent
e1c46c52b0
commit
60506bb195
17
src/init.lua
17
src/init.lua
@ -72,11 +72,9 @@ minetest.register_globalstep(function ( dtime )
|
|||||||
irc.poll();
|
irc.poll();
|
||||||
mt_irc.cur_time = mt_irc.cur_time - mt_irc.dtime;
|
mt_irc.cur_time = mt_irc.cur_time - mt_irc.dtime;
|
||||||
local plys = minetest.get_connected_players();
|
local plys = minetest.get_connected_players();
|
||||||
--Source of flooding in these lines
|
if (#plys <= 0) then -- Just in case :)
|
||||||
--However, bot will not connect to a channel but can PM across minetest and IRC to users ust fine.
|
irc.quit("Closing.");
|
||||||
-- if (#plys <= 0) then -- Just in case :)
|
end
|
||||||
-- irc.quit("Closing.");
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
end);
|
end);
|
||||||
|
|
||||||
@ -85,6 +83,9 @@ minetest.register_on_joinplayer(function ( player )
|
|||||||
irc.register_callback("connect", function ( )
|
irc.register_callback("connect", function ( )
|
||||||
irc.join(mt_irc.channel);
|
irc.join(mt_irc.channel);
|
||||||
irc.say(mt_irc.channel, "*** "..player:get_player_name().." joined the game");
|
irc.say(mt_irc.channel, "*** "..player:get_player_name().." joined the game");
|
||||||
|
for _,player in ipairs(minetest.get_connected_players()) do
|
||||||
|
mt_irc.connected_players[player:get_player_name()] = mt_irc.connect_on_join;
|
||||||
|
end
|
||||||
end);
|
end);
|
||||||
|
|
||||||
irc.register_callback("channel_msg", function ( channel, from, message )
|
irc.register_callback("channel_msg", function ( channel, from, message )
|
||||||
@ -134,14 +135,12 @@ minetest.register_on_joinplayer(function ( player )
|
|||||||
if (not mt_irc.connect_ok) then return; end
|
if (not mt_irc.connect_ok) then return; end
|
||||||
end);
|
end);
|
||||||
|
|
||||||
mt_irc.connected_players[player:get_player_name()] = mt_irc.connect_on_join;
|
|
||||||
|
|
||||||
end);
|
end);
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function ( player )
|
minetest.register_on_leaveplayer(function ( player )
|
||||||
if (not mt_irc.connect_ok) then return; end
|
|
||||||
local name = player:get_player_name();
|
local name = player:get_player_name();
|
||||||
mt_irc.connected_players[name] = false;
|
mt_irc.connected_players[name] = false;
|
||||||
|
if (not mt_irc.connect_ok) then return; end
|
||||||
irc.say(mt_irc.channel, "*** "..name.." left the game");
|
irc.say(mt_irc.channel, "*** "..name.." left the game");
|
||||||
end);
|
end);
|
||||||
|
|
||||||
@ -216,7 +215,7 @@ minetest.register_chatcommand("join", {
|
|||||||
mt_irc.connected_players[name] = true;
|
mt_irc.connected_players[name] = true;
|
||||||
-- Best way I could get bot to autojoin channel was to add the irc.join function here.
|
-- Best way I could get bot to autojoin channel was to add the irc.join function here.
|
||||||
-- Bot won't connect until the first user joins. The bot will not disconect if last player leaves.
|
-- Bot won't connect until the first user joins. The bot will not disconect if last player leaves.
|
||||||
irc.join(mt_irc.channel);
|
--irc.join(mt_irc.channel);
|
||||||
minetest.chat_send_player(name, "IRC: You are now in the channel.");
|
minetest.chat_send_player(name, "IRC: You are now in the channel.");
|
||||||
end;
|
end;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user