diff options
| author | 2021-02-08 20:02:42 +0100 | |
|---|---|---|
| committer | 2021-02-08 20:02:42 +0100 | |
| commit | 90bf065874be13b77b9390d4378d03a8272d113e (patch) | |
| tree | 101d23e9e6490c75307f2e7fc195a48f01aebaf6 | |
| parent | Merge remote-tracking branch 'origin/master' (diff) | |
fix default duration
| -rw-r--r-- | bot/exts/moderation/stream.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bot/exts/moderation/stream.py b/bot/exts/moderation/stream.py index 8b8308925..63bc2c218 100644 --- a/bot/exts/moderation/stream.py +++ b/bot/exts/moderation/stream.py @@ -28,8 +28,7 @@ class Stream(commands.Cog): self, ctx: commands.Context, user: discord.Member, - duration: Expiry = - datetime.datetime.utcnow() + datetime.timedelta(minutes=VideoPermission.default_permission_duration), + duration: Expiry = None, *_ ) -> None: """ @@ -47,6 +46,11 @@ class Stream(commands.Cog): Alternatively, an ISO 8601 timestamp can be provided for the duration. """ + # if duration is none then calculate default duration + if duration is None: + now = datetime.datetime.utcnow() + duration = now + datetime.timedelta(minutes=VideoPermission.default_permission_duration) + # Check if user already has streaming permission already_allowed = any(Roles.video == role.id for role in user.roles) if already_allowed: |