General Updates

This commit is contained in:
insert 2024-05-14 16:49:36 -04:00
parent 5d1200c33a
commit 54af5c5c08
Signed by: insert
GPG key ID: A70775C389ACF105
4 changed files with 33 additions and 2 deletions

1
.gitignore vendored
View file

@ -128,5 +128,6 @@ dmypy.json
# Pyre type checker # Pyre type checker
.pyre/ .pyre/
Deployment/
deepspeech-0.9.3-models.pbmm deepspeech-0.9.3-models.pbmm
deepspeech-0.9.3-models.scorer deepspeech-0.9.3-models.scorer

View file

@ -42,7 +42,7 @@ class ApplicationModal(disnake.ui.Modal):
applicationdenied = False applicationdenied = False
application = inter.text_values.items() application = inter.text_values.items()
for key, value in application: 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 applicationdenied = True
embed_color = disnake.Colour.red() embed_color = disnake.Colour.red()
embed_title = "Auto-Denied Application" 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"), 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") @bot.listen("on_button_click")
async def button_listener(inter: disnake.MessageInteraction): async def button_listener(inter: disnake.MessageInteraction):
if inter.component.custom_id == "Apply": if inter.component.custom_id == "Apply":
@ -164,7 +184,7 @@ async def button_listener(inter: disnake.MessageInteraction):
await user.send("You have been Whitelisted!") await user.send("You have been Whitelisted!")
except: except:
dmstat = ", Failed to DM user" dmstat = ", Failed to DM user"
status = "Aprroved and Whitelisted" status = "Approved and Whitelisted"
embed.add_field( embed.add_field(
name="Status", name="Status",
value=f"{status}{dmstat}", value=f"{status}{dmstat}",

7
dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM python:3.11
WORKDIR /applicationbot
COPY . ./
RUN pip install --timeout 10000 -r requirements.txt
CMD [ "python", "./applicationbot.py"]

3
requirements.txt Normal file
View file

@ -0,0 +1,3 @@
disnake == 2.9.1
python-dotenv
rcon