forked from minetest-mods/irc
		
	Compare commits
	
		
			17 Commits
		
	
	
		
			47f889c178
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| fc46594dbb | |||
|  | c088ba4e40 | ||
| bb8b755362 | |||
|  | 758e9b6361 | ||
| ee81559532 | |||
|  | 7fbbfd6cdb | ||
|  | cc78f12a4c | ||
| 0f46251d00 | |||
|  | ceb40e2bb3 | ||
| 612a94bbf1 | |||
|  | 5e3659761b | ||
|  | ac0387786c | ||
|  | 05ab5e9fbd | ||
| 2a88c47de4 | |||
| 0f00fa8c7e | |||
| 351a86cbf2 | |||
| 1b71c304c5 | 
							
								
								
									
										11
									
								
								.github/workflows/check-release.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								.github/workflows/check-release.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | |||||||
|  | on: [push, pull_request] | ||||||
|  | name: Check & Release | ||||||
|  | jobs: | ||||||
|  |   lint: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@master | ||||||
|  |       - name: lint | ||||||
|  |         uses: Roang-zero1/factorio-mod-luacheck@master | ||||||
|  |         with: | ||||||
|  |           luacheckrc_url: https://raw.githubusercontent.com/minetest-mods/irc/master/.luacheckrc | ||||||
							
								
								
									
										2
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitmodules
									
									
									
									
										vendored
									
									
								
							| @@ -1,3 +1,3 @@ | |||||||
| [submodule "irc"] | [submodule "irc"] | ||||||
| 	path = irc | 	path = irc | ||||||
| 	url = https://sys4.fr/gitea/nalc/LuaIRC.git | 	url = https://sys4.fr/gitea/mtcontrib/LuaIRC.git | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
| allow_defined_top = true | allow_defined_top = true | ||||||
|  |  | ||||||
| read_globals = { | read_globals = { | ||||||
| 	"minetest", | 	"minetest" | ||||||
| } | } | ||||||
|  |  | ||||||
| exclude_files = { | exclude_files = { | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | [](https://github.com/minetest-mods/irc/actions) | ||||||
|  |  | ||||||
| IRC Mod for Minetest | IRC Mod for Minetest | ||||||
| ==================== | ==================== | ||||||
|   | |||||||
| @@ -139,7 +139,7 @@ irc.register_bot_command("whereis", { | |||||||
| 			return false, "There is no player named '"..args.."'" | 			return false, "There is no player named '"..args.."'" | ||||||
| 		end | 		end | ||||||
| 		local fmt = "Player %s is at (%.2f,%.2f,%.2f)" | 		local fmt = "Player %s is at (%.2f,%.2f,%.2f)" | ||||||
| 		local pos = player:getpos() | 		local pos = player:get_pos() | ||||||
| 		return true, fmt:format(args, pos.x, pos.y, pos.z) | 		return true, fmt:format(args, pos.x, pos.y, pos.z) | ||||||
| 	end | 	end | ||||||
| }) | }) | ||||||
| @@ -169,8 +169,10 @@ irc.register_bot_command("players", { | |||||||
| 		for _, player in pairs(players) do | 		for _, player in pairs(players) do | ||||||
| 			table.insert(names, player:get_player_name()) | 			table.insert(names, player:get_player_name()) | ||||||
| 		end | 		end | ||||||
| 		return true, "Connected players: " | 		return true, string.format("%d connected player(s): %s", | ||||||
| 				..table.concat(names, ", ") | 			#players, | ||||||
|  | 			table.concat(names, ", ") | ||||||
|  | 		) | ||||||
| 	end | 	end | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ minetest.register_on_chat_message(function(name, message) | |||||||
| 	if nl then | 	if nl then | ||||||
| 		message = message:sub(1, nl - 1) | 		message = message:sub(1, nl - 1) | ||||||
| 	end | 	end | ||||||
| 	irc.say(irc.playerMessage(name, core.strip_colors(message))) | 	irc.say(irc.playerMessage(name, minetest.strip_colors(message))) | ||||||
| end) | end) | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								config.lua
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								config.lua
									
									
									
									
									
								
							| @@ -7,7 +7,6 @@ irc.config = {} | |||||||
| local function setting(stype, name, default, required) | local function setting(stype, name, default, required) | ||||||
| 	local value | 	local value | ||||||
| 	if minetest.settings and minetest.settings.get and minetest.settings.get_bool then | 	if minetest.settings and minetest.settings.get and minetest.settings.get_bool then | ||||||
| 		-- The current methods for getting settings |  | ||||||
| 		if stype == "bool" then | 		if stype == "bool" then | ||||||
| 			value = minetest.settings:get_bool("irc."..name) | 			value = minetest.settings:get_bool("irc."..name) | ||||||
| 		elseif stype == "string" then | 		elseif stype == "string" then | ||||||
| @@ -15,15 +14,6 @@ local function setting(stype, name, default, required) | |||||||
| 		elseif stype == "number" then | 		elseif stype == "number" then | ||||||
| 			value = tonumber(minetest.settings:get("irc."..name)) | 			value = tonumber(minetest.settings:get("irc."..name)) | ||||||
| 		end | 		end | ||||||
| 	else |  | ||||||
| 		-- The old methods for getting settings for backward compatibility. Deprecated on 0.4.16+ |  | ||||||
| 		if stype == "bool" then |  | ||||||
| 			value = minetest.setting_getbool("irc."..name) |  | ||||||
| 		elseif stype == "string" then |  | ||||||
| 			value = minetest.setting_get("irc."..name) |  | ||||||
| 		elseif stype == "number" then |  | ||||||
| 			value = tonumber(minetest.setting_get("irc."..name)) |  | ||||||
| 		end |  | ||||||
| 	end | 	end | ||||||
| 	if value == nil then | 	if value == nil then | ||||||
| 		if required then | 		if required then | ||||||
|   | |||||||
| @@ -1,4 +0,0 @@ | |||||||
| This mod is just a glue between IRC and Minetest. |  | ||||||
|  |  | ||||||
| It provides two-way communication between the |  | ||||||
| in-game chat, and an arbitrary IRC channel. |  | ||||||
| @@ -120,6 +120,8 @@ function irc.hooks.channelChat(msg) | |||||||
| 		text:find("^%*%*%* ([^%s]+) joined the game$") | 		text:find("^%*%*%* ([^%s]+) joined the game$") | ||||||
| 	local foundleave, _, leavenick = | 	local foundleave, _, leavenick = | ||||||
| 		text:find("^%*%*%* ([^%s]+) left the game$") | 		text:find("^%*%*%* ([^%s]+) left the game$") | ||||||
|  | 	local foundtimedout, _, timedoutnick = | ||||||
|  | 		text:find("^%*%*%* ([^%s]+) left the game %(Timed out%)$") | ||||||
| 	local foundaction, _, actionnick, actionmessage = | 	local foundaction, _, actionnick, actionmessage = | ||||||
| 		text:find("^%* ([^%s]+) (.*)$") | 		text:find("^%* ([^%s]+) (.*)$") | ||||||
|  |  | ||||||
| @@ -134,6 +136,9 @@ function irc.hooks.channelChat(msg) | |||||||
| 	elseif foundleave then | 	elseif foundleave then | ||||||
| 		irc.sendLocal(("*** %s left %s") | 		irc.sendLocal(("*** %s left %s") | ||||||
| 				:format(leavenick, msg.user.nick)) | 				:format(leavenick, msg.user.nick)) | ||||||
|  | 	elseif foundtimedout then | ||||||
|  | 		irc.sendLocal(("*** %s left %s (Timed out)") | ||||||
|  | 				:format(timedoutnick, msg.user.nick)) | ||||||
| 	elseif foundaction then | 	elseif foundaction then | ||||||
| 		irc.sendLocal(("* %s@%s %s") | 		irc.sendLocal(("* %s@%s %s") | ||||||
| 				:format(actionnick, msg.user.nick, actionmessage)) | 				:format(actionnick, msg.user.nick, actionmessage)) | ||||||
| @@ -166,7 +171,7 @@ end | |||||||
|  |  | ||||||
|  |  | ||||||
| function irc.hooks.notice(user, target, message) | function irc.hooks.notice(user, target, message) | ||||||
| 	if user.nick and target == irc.config.channel then | 	if user and user.nick and target == irc.config.channel then | ||||||
| 		irc.sendLocal("-"..user.nick.."@IRC- "..message) | 		irc.sendLocal("-"..user.nick.."@IRC- "..message) | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								init.lua
									
									
									
									
									
								
							| @@ -29,7 +29,8 @@ if not rawget(_G, "jit") and package.config:sub(1, 1) == "/" then | |||||||
| 			";/usr/share/lua/5.1/?/init.lua" | 			";/usr/share/lua/5.1/?/init.lua" | ||||||
|  |  | ||||||
| 	ie.package.cpath = ie.package.cpath.. | 	ie.package.cpath = ie.package.cpath.. | ||||||
| 			";/usr/lib/lua/5.1/?.so" | 			";/usr/lib/lua/5.1/?.so".. | ||||||
|  | 			";/usr/lib64/lua/5.1/?.so" | ||||||
|  |  | ||||||
| 	ie.package.cpath = "/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;"..ie.package.cpath | 	ie.package.cpath = "/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;"..ie.package.cpath | ||||||
|  |  | ||||||
| @@ -110,7 +111,8 @@ end | |||||||
|  |  | ||||||
| minetest.register_privilege("irc_admin", { | minetest.register_privilege("irc_admin", { | ||||||
| 	description = "Allow IRC administrative tasks to be performed.", | 	description = "Allow IRC administrative tasks to be performed.", | ||||||
| 	give_to_singleplayer = true | 	give_to_singleplayer = true, | ||||||
|  | 	give_to_admin = true, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| local stepnum = 0 | local stepnum = 0 | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								mod.conf
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								mod.conf
									
									
									
									
									
								
							| @@ -1 +1,5 @@ | |||||||
| name = irc | name = irc | ||||||
|  | description = """ | ||||||
|  | This mod is just a glue between IRC and Minetest. | ||||||
|  | It provides two-way communication between the in-game chat, and an arbitrary IRC channel. | ||||||
|  | """ | ||||||
|   | |||||||
| @@ -47,7 +47,7 @@ minetest.register_chatcommand("who", { | |||||||
| 			out[n] = plname | 			out[n] = plname | ||||||
| 		end | 		end | ||||||
| 		table.sort(out) | 		table.sort(out) | ||||||
| 		return true, "Players in channel: "..table.concat(out, ", ") | 		return true, n.." player(s) in channel: "..table.concat(out, ", ") | ||||||
| 	end | 	end | ||||||
| }) | }) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user