Skip to content

Commit

Permalink
Str fix and minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBSG committed Jun 19, 2024
1 parent b7915ff commit 71f5f65
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/social.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ async def _profile_timezone(self, interaction: discord.Interaction, timezone: st
async def _profile_games_autocomplete(self, interaction: discord.Interaction, current: str):
return await self.Games._games_search_autocomplete(interaction, current)

@social_group.command(name='games', description='Pick up-to 3 of your fav Nintendo Switch games to show them off')
@social_group.command(name='games', description='Pick up-to 5 of your fav Nintendo Switch games to show them off')
@app_commands.describe(
game1='You need to pick at least one game. Search by name and use autocomplete to help!',
game2='Optionally pick a 2nd game to show on your profile as well. Search by name and use autocomplete to help!',
Expand Down
19 changes: 12 additions & 7 deletions modules/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,11 @@ async def _info(self, interaction: discord.Interaction, user: discord.User):

punishments = ''
punsCol = mclient.bowser.puns.find({'user': user.id, 'type': {'$ne': 'note'}})
puns = 0
if not punsCol.count():
punishments = '__*No punishments on record*__'

else:
puns = 0
activeStrikes = 0
totalStrikes = 0
activeMute = None
Expand Down Expand Up @@ -523,12 +523,17 @@ async def _info(self, interaction: discord.Interaction, user: discord.User):
embed.description += f'\nUser currently has {activeStrikes} active strike{"s" if activeStrikes != 1 else ""} ({totalStrikes} in total)'

embed.add_field(name='Punishments', value=punishments, inline=False)
return await interaction.followup.send(embed=embed, view=self.SuggestHistCommand(interaction))
if puns != 0:
await interaction.followup.send(embed=embed, view=self.SuggestHistCommand(interaction, self))

else:
await interaction.followup.send(embed=embed)

class SuggestHistCommand(discord.ui.View):
def __init__(self, interaction: discord.Interaction):
def __init__(self, interaction: discord.Interaction, ChatCog: commands.Cog):
super().__init__(timeout=600.0)
self.INTERACTION = interaction
self.ChatCog = ChatCog

@discord.ui.button(label='Pull User History', style=discord.ButtonStyle.primary)
async def pull_history(self, interaction: discord.Interaction, button: discord.ui.Button):
Expand All @@ -539,8 +544,7 @@ async def pull_history(self, interaction: discord.Interaction, button: discord.u
user = interaction.client.fetch_user(userid)

self.INTERACTION = interaction
ChatCog = ChatControl(bot=interaction.client)
await ChatCog._pull_history(interaction, user)
await self.ChatCog._pull_history(interaction, user)

async def on_timeout(self):
await self.INTERACTION.edit_original_response(view=None)
Expand Down Expand Up @@ -769,7 +773,8 @@ async def _echo(
@app_commands.guilds(discord.Object(id=config.nintendoswitch))
@app_commands.default_permissions(view_audit_log=True)
@app_commands.checks.has_any_role(config.moderator, config.eh)
async def _roles(self, interaction):
async def _roles(self, interaction: discord.Interaction):
await interaction.response.defer(ephemeral=tools.mod_cmd_invoke_delete(interaction.channel))
lines = []
for role in reversed(interaction.guild.roles):
lines.append(f'{role.name} ({role.id})')
Expand All @@ -783,7 +788,7 @@ async def _roles(self, interaction):
page_character_limit=1500,
)

await interaction.edit_original_response(content='Here is the requested role list:', view=view)
await interaction.followup.send('Here is the requested role list:', view=view)

async def _tag_autocomplete(
self, interaction: discord.Interaction, current: str
Expand Down

0 comments on commit 71f5f65

Please sign in to comment.