allow temporary invites to be created
This commit is contained in:
parent
e4e9eec9b3
commit
2b1e56fd79
@ -8,9 +8,6 @@ ADD app /app
|
|||||||
RUN printf "\n\nTesting your python code for errors\n\n" && \
|
RUN printf "\n\nTesting your python code for errors\n\n" && \
|
||||||
pylint -E /app/*.py
|
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
|
WORKDIR /app
|
||||||
RUN printf "\n#########################\n Run dragon bot by typing \n python bot.py\n#########################\n\n"
|
RUN printf "\n#########################\n Run dragon bot by typing \n python bot.py\n#########################\n\n"
|
||||||
|
|
||||||
|
10
app/bot.py
10
app/bot.py
@ -49,15 +49,23 @@ async def invite(ctx):
|
|||||||
# Default to creating the invite to the #general channel
|
# Default to creating the invite to the #general channel
|
||||||
# if the user is in a voice channel, try to create the invite there
|
# if the user is in a voice channel, try to create the invite there
|
||||||
invite_channel = ctx.message.channel
|
invite_channel = ctx.message.channel
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if ctx.message.author.voice.channel:
|
if ctx.message.author.voice.channel:
|
||||||
invite_channel = ctx.message.author.voice.channel
|
invite_channel = ctx.message.author.voice.channel
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
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(
|
invite = await invite_channel.create_invite(
|
||||||
destination=invite_channel,
|
destination=invite_channel,
|
||||||
max_uses=1,
|
max_uses=1,
|
||||||
max_age=3600
|
max_age=3600,
|
||||||
|
temporary=temp,
|
||||||
)
|
)
|
||||||
await ctx.send(invite)
|
await ctx.send(invite)
|
||||||
|
|
||||||
|
@ -80,7 +80,9 @@ def get_help_message(method):
|
|||||||
],
|
],
|
||||||
'invite': [
|
'invite': [
|
||||||
'Generates a one time use invite to the voice channel you are currently in.\n',
|
'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': [
|
'issue': [
|
||||||
'Creates an issue on gitlab with the passed in parameters\n',
|
'Creates an issue on gitlab with the passed in parameters\n',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user