1
0
mirror of https://github.com/minetest-mods/irc.git synced 2025-06-30 07:00:33 +02: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

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
@ -62,14 +62,14 @@ function irc:bot_command(msg, text)
cmd = text
args = ""
end
if not self.bot_commands[cmd] then
self:reply("Unknown command '"..cmd.."'. Try 'list'."
.." Or use @playername <message> to send a private message")
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