Skip to content

Commit

Permalink
fix: added return values to dnkl functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxgh committed Nov 5, 2023
1 parent ad72611 commit 2a98f27
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/utils/discord_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ async def dnkl_error(channel: discord.TextChannel, author: discord.User, ign: st
title="Your application has been accepted, however there was an error!",
description="Please await staff assistance!",
color=neutral_color))
return True


async def dnkl_deny(channel: discord.TextChannel, author: discord.User, ign: str, uuid: str, embed: discord.Embed,
Expand Down Expand Up @@ -137,6 +138,8 @@ async def dnkl_deny(channel: discord.TextChannel, author: discord.User, ign: str
await channel.send(embed=embed, view=closeView)
await delete_dnkl(ign)

return True


async def dnkl_approve(channel: discord.TextChannel, author: discord.User, ign: str, uuid: str, embed: discord.Embed,
interaction: discord.Interaction):
Expand Down Expand Up @@ -167,6 +170,8 @@ async def dnkl_approve(channel: discord.TextChannel, author: discord.User, ign:
await interaction.response.send_message(
"**Since this user was already on the do-not-kick-list, their entry has been updated.**")

return True


async def create_ticket(user: discord.Member, ticket_name: str, category_name: str = ticket_categories["generic"]):
# Create ticket
Expand Down Expand Up @@ -245,7 +250,6 @@ async def callback(self, interaction: discord.Interaction):
await interaction.response.send_modal(
modal=uiutils.ModalCreator(embed=embed, fields=fields, ign=ign, uuid=uuid,
title="Player Report"))

if option == "Query/Problem":
await ticket.edit(name=f"general-{ign}", topic=f"{interaction.user.id}|",
category=discord.utils.get(interaction.guild.categories,
Expand Down Expand Up @@ -339,9 +343,9 @@ async def callback(self, interaction: discord.Interaction):
name=ticket_categories["generic"]))

# Fetch player data
player_data = await get_hypixel_player(ign)
player_data = await get_hypixel_player(uuid=uuid)
if not player_data:
return await ticket.send(unknown_ign_embed)
return await ticket.send(embed=unknown_ign_embed)
player_data = player_data["stats"]

# Set vars for each stat
Expand Down Expand Up @@ -411,13 +415,14 @@ async def callback(self, interaction: discord.Interaction):
# Send embed and end loop

GvGView = discord.ui.View(timeout=None) # View for staff members to approve/deny the DNKL
buttons = [["Accept", "GvG_Application_Positive", discord.enums.ButtonStyle.green],
["Deny", "GvG_Application_Negative", discord.enums.ButtonStyle.red]]
buttons = (("Accept", "GvG_Application_Positive", discord.enums.ButtonStyle.green, gvg_approve),
("Deny", "GvG_Application_Negative", discord.enums.ButtonStyle.red, gvg_deny))
# Loop through the list of roles and add a new button to the view for each role.
for button in buttons:
# Get the role from the guild by ID.
GvGView.add_item(
uiutils.Button_Creator(channel=ticket, ign=ign, button=button, member=user, uuid=uuid))
uiutils.Button_Creator(channel=ticket, ign=ign, button=button, author=user, uuid=uuid,
function=button[3]))

await ticket.send("Staff, what do you wish to do with this application?", embed=embed,
view=GvGView)
Expand Down

0 comments on commit 2a98f27

Please sign in to comment.