From 2b1e56fd797f2cf94ac9bea529d59d1f36b468fb Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Fri, 28 Aug 2020 12:26:09 -0700 Subject: [PATCH] allow temporary invites to be created --- Dockerfile-test-env | 3 --- app/bot.py | 10 +++++++++- app/help_methods.py | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Dockerfile-test-env b/Dockerfile-test-env index 0ca8b922..f10bc39a 100644 --- a/Dockerfile-test-env +++ b/Dockerfile-test-env @@ -8,9 +8,6 @@ ADD app /app RUN printf "\n\nTesting your python code for errors\n\n" && \ pylint -E /app/*.py -# FROM python:rc-slim-buster -# COPY --from=builder /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/ -# ADD app /app WORKDIR /app RUN printf "\n#########################\n Run dragon bot by typing \n python bot.py\n#########################\n\n" diff --git a/app/bot.py b/app/bot.py index 98c2ac6c..164f3540 100644 --- a/app/bot.py +++ b/app/bot.py @@ -49,15 +49,23 @@ async def invite(ctx): # Default to creating the invite to the #general channel # if the user is in a voice channel, try to create the invite there invite_channel = ctx.message.channel + try: if ctx.message.author.voice.channel: invite_channel = ctx.message.author.voice.channel except AttributeError: pass + + temp = False + if 'temp' in ctx.message.content: + temp = True + await ctx.send('Here is your temporary invite') + invite = await invite_channel.create_invite( destination=invite_channel, max_uses=1, - max_age=3600 + max_age=3600, + temporary=temp, ) await ctx.send(invite) diff --git a/app/help_methods.py b/app/help_methods.py index 26bf9f7a..36b76791 100644 --- a/app/help_methods.py +++ b/app/help_methods.py @@ -80,7 +80,9 @@ def get_help_message(method): ], 'invite': [ 'Generates a one time use invite to the voice channel you are currently in.\n', - 'if you are not in a voice channel, the invite will be for whatever channel !invite was typed in.\n', + 'if you are not in a voice channel, the invite will be for whatever channel !invite was typed in.\n' + 'You can also specify if you want it to be a temporary invite by adding `temp` to the end\n', + 'Usage: !invite or !invite temp' ], 'issue': [ 'Creates an issue on gitlab with the passed in parameters\n',