Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend redo #174

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading