From 54af5c5c08976c9995600392636aa6f4d75069c8 Mon Sep 17 00:00:00 2001 From: insert Date: Tue, 14 May 2024 16:49:36 -0400 Subject: [PATCH] General Updates --- .gitignore | 1 + applicationbot.py | 24 ++++++++++++++++++++++-- dockerfile | 7 +++++++ requirements.txt | 3 +++ 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 dockerfile create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index b343a81..4dbf461 100644 --- a/.gitignore +++ b/.gitignore @@ -128,5 +128,6 @@ dmypy.json # Pyre type checker .pyre/ +Deployment/ deepspeech-0.9.3-models.pbmm deepspeech-0.9.3-models.scorer \ No newline at end of file diff --git a/applicationbot.py b/applicationbot.py index 8f46c46..8122b72 100644 --- a/applicationbot.py +++ b/applicationbot.py @@ -42,7 +42,7 @@ class ApplicationModal(disnake.ui.Modal): applicationdenied = False application = inter.text_values.items() for key, value in application: - if key == "The secret phrase" and value != os.getenv("PHRASE"): + if key == "The secret phrase" and value.lower() != os.getenv("PHRASE"): applicationdenied = True embed_color = disnake.Colour.red() embed_title = "Auto-Denied Application" @@ -133,6 +133,26 @@ async def apply(inter: disnake.AppCmdInter): disnake.ui.Button(label="Apply", style=disnake.ButtonStyle.success, custom_id="Apply"), ]) +@bot.slash_command( + name="reapply", + description="Allow a user to reapply to the server" +) +async def reapply(inter: disnake.AppCmdInter, reason:str, user:disnake.Member): + await inter.response.defer() + guild = bot.get_guild(int(os.getenv("GUILD_ID"))) + role = guild.get_role(int(os.getenv("APPLICANT_ROLE_ID"))) + dmuser = await bot.fetch_user(int(user.id)) + if role in user.roles: + await user.remove_roles(role) + try: + await dmuser.send(f"you have been given a second chance to apply, because {reason}") + await inter.response.edit_original_response("User Notified and application reopened!") + except: + await inter.response.edit_original_response("Failed to notify user, application reopened") + else: + await inter.response.edit_original_response("That user hasn't applied yet!") + + @bot.listen("on_button_click") async def button_listener(inter: disnake.MessageInteraction): if inter.component.custom_id == "Apply": @@ -164,7 +184,7 @@ async def button_listener(inter: disnake.MessageInteraction): await user.send("You have been Whitelisted!") except: dmstat = ", Failed to DM user" - status = "Aprroved and Whitelisted" + status = "Approved and Whitelisted" embed.add_field( name="Status", value=f"{status}{dmstat}", diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..da9885a --- /dev/null +++ b/dockerfile @@ -0,0 +1,7 @@ +FROM python:3.11 + +WORKDIR /applicationbot + +COPY . ./ +RUN pip install --timeout 10000 -r requirements.txt +CMD [ "python", "./applicationbot.py"] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..cab5888 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +disnake == 2.9.1 +python-dotenv +rcon