Compare commits

..

No commits in common. "56fc1cea58d696c97b2eebc5e8e87dac9b857a8d" and "5d1200c33aa5fb166bb5715065e51ac39db77e7d" have entirely different histories.

4 changed files with 4 additions and 35 deletions

1
.gitignore vendored
View file

@ -128,6 +128,5 @@ 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.lower() != os.getenv("PHRASE"): if key == "The secret phrase" and value != 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"
@ -105,8 +105,8 @@ async def whitelist(
) )
async def execute(inter: disnake.AppCmdInter, command:str): async def execute(inter: disnake.AppCmdInter, command:str):
await inter.response.defer() await inter.response.defer()
if int(os.getenv("ADMIN_ROLE_ID") not in user.roles: if inter.user.id != int(os.getenv("ADMIN_ID")):
await inter.edit_original_response(content="Only the server admins may run this command") await inter.edit_original_response(content="Only the server admin may run this command")
return return
with Client(os.getenv("RCON_IP"), int(os.getenv("RCON_PORT")), passwd=os.getenv("RCON_PASSWORD")) as client: with Client(os.getenv("RCON_IP"), int(os.getenv("RCON_PORT")), passwd=os.getenv("RCON_PASSWORD")) as client:
response = client.run(command) response = client.run(command)
@ -133,26 +133,6 @@ 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":
@ -184,7 +164,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 = "Approved and Whitelisted" status = "Aprroved and Whitelisted"
embed.add_field( embed.add_field(
name="Status", name="Status",
value=f"{status}{dmstat}", value=f"{status}{dmstat}",

View file

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

View file

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