Compare commits
2 commits
5d1200c33a
...
56fc1cea58
Author | SHA1 | Date | |
---|---|---|---|
56fc1cea58 | |||
54af5c5c08 |
4 changed files with 35 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -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
|
|
@ -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"
|
||||||
|
@ -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 inter.user.id != int(os.getenv("ADMIN_ID")):
|
if int(os.getenv("ADMIN_ROLE_ID") not in user.roles:
|
||||||
await inter.edit_original_response(content="Only the server admin may run this command")
|
await inter.edit_original_response(content="Only the server admins 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,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
7
dockerfile
Normal 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
3
requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
disnake == 2.9.1
|
||||||
|
python-dotenv
|
||||||
|
rcon
|
Loading…
Reference in a new issue