include max_usage in call and option for different date format even though it's not working

This commit is contained in:
William Kray 2021-05-07 22:22:04 -07:00
parent f79b1e3ded
commit 20a9ab5cd7

View File

@ -53,7 +53,12 @@ class Invite(Plugin):
ex_date = datetime.datetime.strftime( \
(datetime.date.today() + datetime.timedelta(days=self.config["expiration"])), \
"%m.%d.%Y")
"%Y.%m.%d")
# use re-ordered date if using legacy code
if self.config["legacy_mr"] == True:
ex_date = datetime.datetime.strftime( \
(datetime.date.today() + datetime.timedelta(days=self.config["expiration"])), \
"%m.%d.%Y")
headers = {
'Authorization': f"SharedSecret {self.config['admin_secret']}",
'Content-Type': 'application/json'
@ -61,7 +66,7 @@ class Invite(Plugin):
try:
response = await self.http.post(f"{self.config['api_url']}/token", headers=headers, \
json={"one_time": True, "ex_date": ex_date})
json={"max_usage": 1, "one_time": True, "ex_date": ex_date})
resp_json = await response.json()
except Exception as e:
await evt.respond(f"request failed: {e.message}")