Skip to content

Commit

Permalink
Context menu for history command
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBSG committed Jun 18, 2024
1 parent 6eb8f7a commit e3080bf
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions modules/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ def __init__(self, bot):
"walmart.*": ["sourceid", "veh", "wmlspartner"],
}

# Add context menus to command tree
self.historyContextMenu = app_commands.ContextMenu(
name='View History',
callback=self._pull_history,
type=discord.AppCommandType.user
)
self.bot.tree.add_command(
self.historyContextMenu,
guild=discord.Object(id=config.nintendoswitch)
)

# Called after automod filter finished, because of the affilite link reposter. We also want to wait for other items in this function to complete to call said reposter.
async def on_automod_finished(self, message):
if message.type == discord.MessageType.premium_guild_subscription:
Expand Down Expand Up @@ -545,9 +556,10 @@ async def on_timeout(self):
@app_commands.default_permissions(view_audit_log=True)
@app_commands.checks.has_any_role(config.moderator, config.eh)
async def _history(self, interaction: discord.Interaction, user: typing.Optional[discord.User]):
if not user: user = interaction.user
return await self._pull_history(interaction, user)

async def _pull_history(self, interaction: discord.Interaction, user: typing.Optional[discord.User]):
async def _pull_history(self, interaction: discord.Interaction, user: discord.User):
if user is None:
user = interaction.user

Expand All @@ -565,7 +577,7 @@ async def _pull_history(self, interaction: discord.Interaction, user: typing.Opt
)

else:
await interaction.response.defer()
await interaction.response.defer(ephemeral=tools.mod_cmd_invoke_delete(interaction.channel))
self_check = False

db = mclient.bowser.puns
Expand Down

0 comments on commit e3080bf

Please sign in to comment.