Skip to content

Commit

Permalink
Merge pull request #174 from MiscGuild/backend-redo
Browse files Browse the repository at this point in the history
Backend redo
  • Loading branch information
Amxgh authored Mar 21, 2024
2 parents 063163c + 9417546 commit a77254f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/func/Union.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
pos_color, registration_channel_id,
staff_impersonation_embed, ticket_categories,
unknown_ign_embed, join_request_embed)
from src.utils.db_utils import update_member, insert_new_member
from src.utils.discord_utils import (create_ticket, has_tag_perms,
is_linked_discord)
from src.utils.request_utils import (get_gtag, get_hypixel_player,
Expand Down Expand Up @@ -84,6 +85,7 @@ async def sync(self, ctx, name: str, tag: str = None, is_fs=False):
if not ign:
return unknown_ign_embed


# Initialize vars for storing changes
roles_to_add = []
roles_to_remove = [bot.processing]
Expand All @@ -99,6 +101,9 @@ async def sync(self, ctx, name: str, tag: str = None, is_fs=False):
return embed.add_field(name="Do the above and then enter the following in chat:",
value=f"`{str(self.user)}`")

await update_member(discord_id=self.user.id,
uuid=uuid,
username=ign)
guild_name = "no guild" if not guild_data else guild_data["name"]
can_tag = await has_tag_perms(self.user)

Expand Down Expand Up @@ -167,6 +172,9 @@ async def register(self, ctx, name):
if ign in bot.staff_names:
return staff_impersonation_embed, None

await insert_new_member(discord_id=self.user.id,
uuid=uuid,
username=ign)
# Fetch player & guild data
guild_data = await get_player_guild(uuid)

Expand Down Expand Up @@ -253,7 +261,7 @@ async def callback(self, interaction: discord.Interaction):
await ctx.author.remove_roles(bot.new_member_role, reason="Register")
await ctx.author.edit(nick=ign)

return (embed, guest_ticket) if guild_name != guild_handle else (None, None)
return (embed, guest_ticket) if guild_name != guild_handle else (embed, None)

async def add(self, ctx):
if ctx.channel.category.name not in ticket_categories.values():
Expand Down

0 comments on commit a77254f

Please sign in to comment.