plugins/mod_invites.lua
changeset 13414 7efdd143fdfc
parent 13359 a6c8a50cdfb5
child 13415 d815882d2692
--- a/plugins/mod_invites.lua	Sun Dec 17 19:02:56 2023 +0100
+++ b/plugins/mod_invites.lua	Sat Jan 13 10:58:12 2024 +0100
@@ -4,6 +4,7 @@
 local jid_node = require "prosody.util.jid".node;
 local jid_split = require "prosody.util.jid".split;
 local argparse = require "prosody.util.argparse";
+local human_io = require "prosody.util.human.io";
 
 local default_ttl = module:get_option_period("invite_expiry", "1 week");
 
@@ -283,6 +284,7 @@
 		print("    --role ROLE       Grant the given ROLE to the new user")
 		print("    --group GROUPID   Add the user to the group with the given ID")
 		print("                      Can be specified multiple times")
+		print("    --expires-after T Time until the invite expires (e.g. '1 week')")
 		print()
 		print("--group can be specified multiple times; the user will be added to all groups.")
 		print()
@@ -332,7 +334,7 @@
 		invite = assert(invites.create_account(nil, {
 			roles = roles,
 			groups = groups
-		}));
+		}, opts.expires_after and human_io.parse_duration(opts.expires_after)));
 	end
 
 	print(invite.landing_page or invite.uri);