allow temporary invites to be created

This commit is contained in:
Luke Robles 2020-08-28 12:26:09 -07:00
parent e4e9eec9b3
commit 2b1e56fd79
3 changed files with 12 additions and 5 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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',