From 6f1b47e9d543f3ba6646a0e0359002dccea31576 Mon Sep 17 00:00:00 2001 From: Amogh Date: Mon, 23 Oct 2023 20:58:29 -0500 Subject: [PATCH 1/3] fix: fixed generate_rank_upgrade --- src/utils/referral_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/referral_utils.py b/src/utils/referral_utils.py index 547ecd26..db8e3427 100644 --- a/src/utils/referral_utils.py +++ b/src/utils/referral_utils.py @@ -71,7 +71,7 @@ async def generate_rank_upgrade(weekly_invites : list): # A player gets 7 entries for every valid invite they have made total_invitations = 0 for uuid, invitations in weekly_invites: - entries[uuid] = entries[uuid] + (len(invitations)*7) + entries[uuid] = entries[uuid] + (len(invitations)*7) if uuid in entries else (len(invitations)*7) total_invitations += len(invitations) weighted_entries = [uuid for uuid, weight in entries.items() for _ in range(weight)] From bce1a19476ed589705cdcfa3bf4d59cc0f693423 Mon Sep 17 00:00:00 2001 From: Amogh Date: Mon, 23 Oct 2023 20:59:07 -0500 Subject: [PATCH 2/3] feat: /register now sends an ephemeral message redirecting the user to another channel --- src/cogs/tickets.py | 5 ++++- src/func/Union.py | 14 ++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/cogs/tickets.py b/src/cogs/tickets.py index 67c55de6..1a0102b0 100644 --- a/src/cogs/tickets.py +++ b/src/cogs/tickets.py @@ -26,9 +26,12 @@ def __init__(self, bot): ) async def register(self, ctx, name: str): """Register with your IGN to sync your roles!""" - res = await Union(user=ctx.author).register(ctx, name) + res, guest_ticket = await Union(user=ctx.author).register(ctx, name) if isinstance(res, discord.Embed): await ctx.respond(embed=res) + if guest_ticket: + print(guest_ticket) + await ctx.followup.send(f"Head on over to <#{guest_ticket.id}>!", ephemeral=True) if isinstance(res, String): await ctx.respond(res) diff --git a/src/func/Union.py b/src/func/Union.py index 95676b60..cfc4279d 100644 --- a/src/func/Union.py +++ b/src/func/Union.py @@ -162,11 +162,11 @@ async def register(self, ctx, name): ign, uuid = await get_mojang_profile(name) if not ign: - return unknown_ign_embed + return unknown_ign_embed, None # Filter out people impersonating staff if ign in bot.staff_names: - return staff_impersonation_embed + return staff_impersonation_embed, None # Fetch player & guild data guild_data = await get_player_guild(uuid) @@ -188,6 +188,7 @@ async def register(self, ctx, name): await ctx.response.send_modal(modal=uiutils.ModalCreator(embed=embed, fields=fields, ign=ign, uuid=uuid, title="Player Reference", function=validate_reference)) await ctx.author.add_roles(bot.member_role, reason="Registration - Member") + guest_ticket = None # User is in an allied guild elif guild_name in allies: @@ -198,6 +199,7 @@ async def register(self, ctx, name): gtag = "" if "tag" not in guild_data else guild_data["tag"] if not ctx.author.nick or gtag not in ctx.author.nick: ign = ign + " " + f"[{gtag}]" + guest_ticket = None # User is a guest else: @@ -209,7 +211,7 @@ async def register(self, ctx, name): await ticket.edit(name=f"join-request-{ign}", topic=f"{ctx.author.id}|", category=discord.utils.get(ctx.guild.categories, name=ticket_categories["registrees"])) - + guest_ticket = ticket class Join_Misc_Buttons(discord.ui.Button): def __init__(self, button: list): """ @@ -259,10 +261,10 @@ async def callback(self, interaction: discord.Interaction): view=view) # Remove new member role, edit nick and delete message - await ctx.author.remove_roles(bot.new_member_role, reason="Register") - await ctx.author.edit(nick=ign) + #await ctx.author.remove_roles(bot.new_member_role, reason="Register") + #await ctx.author.edit(nick=ign) - return embed if guild_name != guild_handle else None + return (embed, guest_ticket) if guild_name != guild_handle else (None, None) async def add(self, ctx): if ctx.channel.category.name not in ticket_categories.values(): From 71358a41ca2e0af68eeb244bc176f11bafe15863 Mon Sep 17 00:00:00 2001 From: Amogh Date: Mon, 23 Oct 2023 21:12:58 -0500 Subject: [PATCH 3/3] feat: added cvc to the list of accepted milestone gamemodes --- src/func/Union.py | 4 ++-- src/utils/consts.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/func/Union.py b/src/func/Union.py index cfc4279d..d9b21e75 100644 --- a/src/func/Union.py +++ b/src/func/Union.py @@ -261,8 +261,8 @@ async def callback(self, interaction: discord.Interaction): view=view) # Remove new member role, edit nick and delete message - #await ctx.author.remove_roles(bot.new_member_role, reason="Register") - #await ctx.author.edit(nick=ign) + 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) diff --git a/src/utils/consts.py b/src/utils/consts.py index 9978c7a7..d5b7e77b 100644 --- a/src/utils/consts.py +++ b/src/utils/consts.py @@ -75,6 +75,7 @@ "turbo_kart_racers": "Turbo Kart Racers", "pit": "The Pit", "murder_mystery": "Murder Mystery", + "copsvcrims": "Cops and Crims", "miscellaneous": "Miscellaneous", "discord": "Discord", "other": "Other" @@ -92,6 +93,7 @@ "turbo_kart_racers": "<:TurboKartRacers64:846306861950304267>", "pit": "<:pit:851361342744690728>", "murder_mystery": "<:MurderMystery64:823036899974447105>", + "copsvcrims": "<:CVC64:846306846717378560>", "miscellaneous": "<:Misc:540990817872117780>", "discord": "<:discord:977349801412788266>", "other": "❓"