Skip to content

Commit

Permalink
Merge pull request #157 from MiscGuild/bug-fixes-rolecheck
Browse files Browse the repository at this point in the history
Bug fixes rolecheck
  • Loading branch information
Amxgh authored Nov 13, 2023
2 parents 75e53b4 + 411645b commit 7bc7ac1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/func/General.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ async def rolecheck(ctx, send_ping: bool):
req = await get_player_guild(ally_uuids[-1])
gtag = " " if not req["tag"] or not req else req["tag"]
ally_divisions.append([len(ally_uuids), gtag])
# Ally divisions marks the separation point of one guild from another in the ally_uuids array along with the guild's gtag
# Ally divisions marks the separation point of one guild
# from another in the ally_uuids array along with the guild's gtag

# Limiting the maximum concurrency
async def gather_with_concurrency(n, *tasks):
Expand Down Expand Up @@ -139,6 +140,17 @@ async def sem_task(task):
if username in ally_usernames:
# Get player gtag
position = ally_usernames.index(username)
dividers = [x[0] for x in ally_divisions]
tags = [x[1] for x in ally_divisions]

start = 0
for divider in dividers:
if start <= position < divider:
gtag = tags[dividers.index(divider)]
break
start = divider

'''
last_value = 1
for guild_division in ally_divisions:
if last_value > 1:
Expand All @@ -148,7 +160,7 @@ async def sem_task(task):
elif position < guild_division[0]:
gtag = guild_division[1]
last_value = guild_division[0]

'''
# Set nick
if not discord_member.nick or f" [{gtag}]" not in discord_member.nick:
await discord_member.edit(nick=username + f' [{gtag}]')
Expand Down
2 changes: 1 addition & 1 deletion src/utils/discord_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ async def callback(self, interaction: discord.Interaction):
await interaction.response.send_modal(
modal=uiutils.ModalCreator(embed=embed, fields=fields, ign=ign, title="GvG Request"))
return
if option == f"My guild wishes to ally {guild_handle}":
if option == f"My guild wishes to ally {guild_handle}":
await ticket.edit(name=f"alliance-request-{ign}", topic=f"{interaction.user.id}|",
category=discord.utils.get(interaction.guild.categories,
name=ticket_categories["generic"]))
Expand Down

0 comments on commit 7bc7ac1

Please sign in to comment.