Skip to content

Commit

Permalink
Full command test pass testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBSG committed Jun 23, 2024
1 parent 6a1d63f commit 4208bff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
13 changes: 6 additions & 7 deletions modules/social.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ async def return_failure(interaction: discord.Interaction, game_name: str):
await msg.delete()

await interaction.followup.send(
message_reply, file=await self._generate_profile_card_from_member(interaction.user)
message_reply, file=await self._generate_profile_card_from_member(interaction.user), ephemeral=True
)

class BackgroundSelectMenu(discord.ui.View):
Expand Down Expand Up @@ -1053,7 +1053,6 @@ async def select_option(self, interaction: discord.Interaction):
f'{config.greenTick} Your background has been successfully updated on your profile card! Here\'s how it looks:',
file=await self.Parent._generate_profile_card_from_member(interaction.user),
embed=None,
view=None,
ephemeral=True,
)
self.stop()
Expand All @@ -1064,14 +1063,14 @@ async def select_option(self, interaction: discord.Interaction):

async def cancel_button(self, interaction: discord.Interaction):
await interaction.response.edit_message(
content='Background editing canceled. To begin again, rerun the command', embed=None, view=None
content='Background editing canceled. To begin again, rerun the command', attachments=[], embed=None, view=None
)
self.stop()

async def on_timeout(self):
if self.message:
if self.message and not self.is_finished():
await self.message.edit(
content='Background editing timed out. To begin again, rerun the command', embed=None, view=None
content='Background editing timed out. To begin again, rerun the command', attachments=[], embed=None, view=None
)

@social_group.command(name='background', description='Update the background you use on your profile card')
Expand Down Expand Up @@ -1247,7 +1246,7 @@ async def _trivia_award(self, interaction, members: str):
await interaction.response.send_message(f'{config.loading} Processing awards to {len(members)} member(s)...')
for m in members:
try:
user = int(user)
user = int(m)
m = interaction.guild.get_member(user)
if not m:
try:
Expand Down Expand Up @@ -1297,7 +1296,7 @@ async def _trivia_reduce(self, interaction: discord.Interaction, members: str):
await interaction.response.send_message(f'{config.loading} Reducing awards from {len(members)} member(s)...')
for m in members:
try:
user = int(user)
user = int(m)
m = interaction.guild.get_member(user)
if not m:
try:
Expand Down
18 changes: 7 additions & 11 deletions modules/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async def _stats_server(

dayStr = (
'In the last 30 days'
if not start
if not start and not end
else 'Between ' + searchDate.strftime('%Y-%m-%d') + ' and ' + endDate.strftime('%Y-%m-%d')
)
netMembers = netJoins - netLeaves
Expand Down Expand Up @@ -216,24 +216,20 @@ async def _stats_roles(
await interaction.response.send_message('One moment, crunching the numbers...')
if role:
lines = []
desc = f'There are currently **{len(role.members)}** users with the **{role.name}** role:\n\n'
desc = f'There are currently **{len(role.members)}** members with the **{role.name}** role:\n\n'
for member in role.members:
lines.append(f'* {member} ({member.id})')

title = f'{interaction.guild.name} Role Statistics'
fields = tools.convert_list_to_fields(lines)
await interaction.delete_original_response()
# TODO: embed pagination need to be converted to UI Kit
return await tools.send_paginated_embed(
self.bot,
interaction.channel,
fields,
owner=interaction.user,
view = tools.PaginatedEmbed(
interaction=interaction,
fields=fields,
title=title,
description=desc,
color=0xD267BA,
page_character_limit=3000,
color=0xD267BA
)
return await interaction.edit_original_response(content='Here is the requested list of members with that role:', view=view)

else:
roleCounts = []
Expand Down
9 changes: 1 addition & 8 deletions modules/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,7 @@ def message_filter(message):
# Message may not exist
pass

if count >= 100:
# Original interaction deleted
m = await interaction.channel.send(f'{config.greenTick} Clean action complete')

else:
# Original interaction still available, need to use followup
m = await interaction.followup.send(f'{config.greenTick} Clean action complete', wait=True)

m = await interaction.channel.send(f'{config.greenTick} Clean action complete')
return await m.delete(delay=5)

@app_commands.guilds(discord.Object(id=config.nintendoswitch))
Expand Down

0 comments on commit 4208bff

Please sign in to comment.