Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Fix registrations #182

Merged
merged 2 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions trainerdex/discord_bot/modules/leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ async def leaderboard(
stat: str,
) -> None:
await ctx.interaction.response.defer()
ctx.interaction.response._responded = True

if not ctx.guild:
selection = LeaderboardType.GLOBAL.value[0]
Expand Down
6 changes: 4 additions & 2 deletions trainerdex/discord_bot/modules/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ async def allowed_to_assign_roles(self, ctx: ApplicationContext) -> bool:
return bool(ctx.author.guild_permissions.manage_roles)

def allowed_to_create_profiles(self) -> bool:
return datetime.utcnow() < SHUTDOWN_DATE
# return datetime.utcnow() < SHUTDOWN_DATE
return True

def compare_stats(self, x: Update, y: Mapping[str, int | Decimal | None], /) -> bool:
x_, y_ = vars(x), deepcopy(y)
Expand Down Expand Up @@ -160,6 +161,7 @@ async def slash__approve(
return

await ctx.interaction.response.defer()
ctx.interaction.response._responded = True
reason = f"{ctx.author} used the /approve command to grant {member} access to this guild."

allowed_to_rename: bool = await self.allowed_to_rename(ctx)
Expand Down Expand Up @@ -288,7 +290,7 @@ async def slash__approve(
actions_commited.append(f"Updated {trainer.username} with new stats; {stats_humanize}")

if actions_commited:
response: WebhookMessage = await ctx.followup.send(
response: WebhookMessage = await ctx.respond(
f"`/approve` run on {member.mention}\n" + "\n".join(actions_commited),
wait=True,
)
Expand Down
2 changes: 2 additions & 0 deletions trainerdex/discord_bot/modules/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ async def update_via_slash_command(
return

await ctx.interaction.response.defer()
ctx.interaction.response._responded = True

if image and not kwargs:
await ctx.respond(
Expand Down Expand Up @@ -332,6 +333,7 @@ async def update_via_slash_command(
# return

# await ctx.interaction.response.defer()
# ctx.interaction.response._responded = True

# await ctx.respond(
# content=chat_formatting.info(
Expand Down
2 changes: 2 additions & 0 deletions trainerdex/discord_bot/modules/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async def slash__profile(
) -> None:
"""Find a profile given a username or user mention."""
await ctx.interaction.response.defer(invisible=False)
ctx.interaction.response._responded = True

async with self.client() as client:
if username or user:
Expand All @@ -57,6 +58,7 @@ async def user__profile(
user: User,
) -> None:
await ctx.interaction.response.defer()
ctx.interaction.response._responded = True

async with self.client() as client:
trainer = await get_trainer_from_user(client, user)
Expand Down
2 changes: 2 additions & 0 deletions trainerdex/discord_bot/modules/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ async def guild_config__access_roles(
return

await ctx.interaction.response.defer()
ctx.interaction.response._responded = True

guild_config: GuildConfig = await self.config.get_guild(ctx.guild)

Expand Down Expand Up @@ -175,6 +176,7 @@ async def guild_config__mod_roles(self, ctx: ApplicationContext, action: str, ro
return

await ctx.interaction.response.defer()
ctx.interaction.response._responded = True

guild_config: GuildConfig = await self.config.get_guild(ctx.guild)

Expand Down