mirror of
https://github.com/williamkray/maubot-invite.git
synced 2024-10-01 01:25:35 -04:00
include max_usage in call and option for different date format even though it's not working
This commit is contained in:
parent
f79b1e3ded
commit
20a9ab5cd7
@ -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}")
|
||||
|
Loading…
Reference in New Issue
Block a user