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

Minor changes to botcmds.lua.

- Merge `list` into `help`.
- Use `table.concat` to remove trailing comma.
This commit is contained in:
Diego Martínez 2016-11-28 22:17:08 -03:00
parent 160088c232
commit 12248cc847

View File

@ -89,7 +89,13 @@ irc:register_bot_command("help", {
description = "Get help about a command",
func = function(user, args)
if args == "" then
return false, "No command name specified. Use 'list' for a list of commands."
local cmdlist = { }
for name, cmd in pairs(irc.bot_commands) do
cmdlist[#cmdlist+1] = name
end
return true, "Available commands: "..table.concat(cmdlist, ", ")
.." -- Use 'help <command name>' to get"
.." help about a specific command."
end
local cmd = irc.bot_commands[args]
@ -110,12 +116,8 @@ irc:register_bot_command("list", {
params = "",
description = "List available commands.",
func = function(user, args)
local cmdlist = "Available commands: "
for name, cmd in pairs(irc.bot_commands) do
cmdlist = cmdlist..name..", "
end
return true, cmdlist.." -- Use 'help <command name>' to get"
.." help about a specific command."
return false, "The `list` command has been merged into `help`."
.." Use `help` with no arguments to get a list."
end
})