1
0
mirror of https://github.com/minetest-mods/irc.git synced 2024-12-27 01:10:17 +01:00

Add .luacheckrc and fix warnings.

This commit is contained in:
Diego Martínez 2017-02-16 02:36:04 -03:00
parent 6bbb26f9f9
commit 33542b07fe
5 changed files with 31 additions and 16 deletions

14
.luacheckrc Normal file
View File

@ -0,0 +1,14 @@
unused_args = false
allow_defined_top = true
read_globals = {
"minetest",
}
exclude_files = {
"irc/*",
}
globals = {
}

View File

@ -40,7 +40,7 @@ function irc:bot_command(msg, text)
-- Remove leading whitespace
text = text:match("^%s*(.*)")
if text:sub(1, 1) == "@" then
local found, _, player_to, message = text:find("^.([^%s]+)%s(.+)$")
local _, _, player_to, message = text:find("^.([^%s]+)%s(.+)$")
if not minetest.get_player_by_name(player_to) then
irc:reply("User '"..player_to.."' is not in the game.")
return
@ -69,7 +69,7 @@ function irc:bot_command(msg, text)
return
end
local success, message = self.bot_commands[cmd].func(msg.user, args)
local _, message = self.bot_commands[cmd].func(msg.user, args)
if message then
self:reply(message)
end

View File

@ -76,8 +76,8 @@ minetest.register_chatcommand("irc_disconnect", {
if not irc.connected then
return false, "Not connected to IRC. Use /irc_connect to connect."
end
if params == "" then
params = "Manual disconnect by "..name
if param == "" then
param = "Manual disconnect by "..name
end
irc:disconnect(param)
end
@ -113,6 +113,7 @@ minetest.register_chatcommand("irc_quote", {
local oldme = minetest.chatcommands["me"].func
-- luacheck: ignore
minetest.chatcommands["me"].func = function(name, param, ...)
irc:say(("* %s %s"):format(name, param))
return oldme(name, param, ...)

View File

@ -52,7 +52,7 @@ irc = {
}
-- Compatibility
mt_irc = irc
rawset(_G, "mt_irc", irc)
dofile(modpath.."/config.lua")
dofile(modpath.."/messages.lua")
@ -113,7 +113,7 @@ function irc:connect()
-- We need to swap the `require` function again since
-- LuaIRC `require`s `ssl` if `irc.secure` is true.
local old_require = require
old_require = require
require = ie.require
local good, message = pcall(function()

View File

@ -40,9 +40,9 @@ minetest.register_chatcommand("who", {
privs = {},
func = function(name, param)
local out, n = { }, 0
for name in pairs(irc.joined_players) do
for plname in pairs(irc.joined_players) do
n = n + 1
out[n] = name
out[n] = plname
end
table.sort(out)
return true, "Players in channel: "..table.concat(out, ", ")