This commit is contained in:
pacnpal
2024-11-16 02:06:33 +00:00
parent fa494dccd3
commit b2369d6e61

View File

@@ -97,17 +97,29 @@ class VideoArchiver(GroupCog):
"""Helper method to handle responses for both regular commands and interactions""" """Helper method to handle responses for both regular commands and interactions"""
try: try:
if hasattr(ctx, 'interaction') and ctx.interaction: if hasattr(ctx, 'interaction') and ctx.interaction:
if not ctx.interaction.response.is_done(): try:
if embed: # Check if this is a deferred interaction
await ctx.interaction.response.send_message(content=content, embed=embed) if ctx.interaction.response.is_done():
# Use followup for deferred responses
if embed:
await ctx.followup.send(content=content, embed=embed, wait=True)
else:
await ctx.followup.send(content=content, wait=True)
else: else:
await ctx.interaction.response.send_message(content=content) # Use regular response for non-deferred interactions
else: if embed:
await ctx.interaction.response.send_message(content=content, embed=embed)
else:
await ctx.interaction.response.send_message(content=content)
except discord.errors.InteractionResponded:
# If we get here, the interaction was already responded to
# Use followup as a fallback
if embed: if embed:
await ctx.followup.send(content=content, embed=embed) await ctx.followup.send(content=content, embed=embed, wait=True)
else: else:
await ctx.followup.send(content=content) await ctx.followup.send(content=content, wait=True)
else: else:
# Regular command response
if embed: if embed:
await ctx.send(content=content, embed=embed) await ctx.send(content=content, embed=embed)
else: else:
@@ -419,9 +431,9 @@ class VideoArchiver(GroupCog):
@archiver.command(name="settemplate") @archiver.command(name="settemplate")
@guild_only() @guild_only()
@checks.admin_or_permissions(administrator=True) @checks.admin_or_permissions(administrator=True)
@app_commands.describe(template="The message template to use") @app_commands.describe(template="The message template to use. Available placeholders: {author}, {channel}, {original_message}")
async def set_message_template(self, ctx: Context, *, template: str): async def set_message_template(self, ctx: Context, template: str):
"""Set the template for archived messages. Use {author}, {channel}, and {original_message} as placeholders.""" """Set the template for archived messages."""
try: try:
if not any( if not any(
ph in template for ph in ["{author}", "{channel}", "{original_message}"] ph in template for ph in ["{author}", "{channel}", "{original_message}"]