# HG changeset patch # User Trần H. Trung # Date 1690784154 -25200 # Node ID 4379e0e84ee5f087db1c3c07cfb80fa0554c7b9e # Parent 38783b8acbc9f06ca7f381a76296954fa638e263 mod_invites_api: fix error messages when not `found`. diff -r 38783b8acbc9 -r 4379e0e84ee5 mod_invites_api/mod_invites_api.lua --- a/mod_invites_api/mod_invites_api.lua Mon Jul 31 12:49:04 2023 +0700 +++ b/mod_invites_api/mod_invites_api.lua Mon Jul 31 13:15:54 2023 +0700 @@ -453,7 +453,7 @@ print("Error: Could not find "..arg_name_orig.." in "..domain); print(""); print("To make this API key, run:"); - print("prosodyctl "..module.name.." create "..domain.." "..arg_name_orig); + print("> prosodyctl "..module.name.." create "..domain.." "..arg_name_orig); return 1; end return; @@ -484,7 +484,7 @@ print("Error: Could not find the key for "..username.."@"..domain); print(""); print("To make this API key, run:"); - print("prosodyctl "..module.name.." create "..username.."@"..domain); + print("> prosodyctl "..module.name.." create "..username.."@"..domain); return 1; end return; @@ -516,11 +516,10 @@ end end); if not found then - date = datetime.datetime(os_time); print("Error: Could not find "..arg_name.." in "..domain); print(""); print("To make this API key, run:"); - print("prosodyctl "..module.name.." create "..domain.." "..arg_name); + print("> prosodyctl "..module.name.." create "..domain.." "..arg_name); return 1; end return; @@ -651,21 +650,40 @@ return; end elseif command == "url" then + found = false; local name = table.remove(arg, 1); if name and not username then get_value(function (id, info) if info.name == name then print(get_url(id, info.token)); + found = true; end end); + if not found then + date = datetime.datetime(os_time); + print("Error: Could not find "..name.." in "..domain); + print(""); + print("To make this API key, run:"); + print("> prosodyctl "..module.name.." create "..domain.." "..name); + return 1; + end return; elseif username then get_value(function (id, info) local j = jid.prepped_split(info.jid); if j == username then print(get_url(id, info.token)); + found = true; end end); + if not found then + date = datetime.datetime(os_time); + print("Error: Could not find "..username.."@"..domain); + print(""); + print("To make this API key, run:"); + print("> prosodyctl "..module.name.." create "..username.."@"..domain); + return 1; + end return; else get_value(function (id, info)