misc/add compliment bridge command

This commit is contained in:
2025-02-14 07:10:09 -05:00
parent 43ecfc6633
commit 2c2d191a08
5 changed files with 66 additions and 5 deletions

View File

@ -255,6 +255,40 @@ class Misc(commands.Cog):
except Exception as e:
traceback.print_exc()
return await ctx.respond(f"Insult failed :(\nError: {str(e)}")
@bridge.bridge_command()
async def compliment(self, ctx, *,
recipient: Optional[str] = None) -> None:
"""
Compliment someone (or yourself)
Args:
ctx (Any)
recipient (Optional[str])
Returns:
None
"""
try:
authorDisplay: str = ctx.author.display_name if not(ctx.author.display_name is None)\
else ctx.message.author.display_name
if recipient is None:
recipient: str = authorDisplay.strip()
else:
if discord.utils.raw_mentions(recipient):
# There are mentions
recipient_id: int = discord.utils.raw_mentions(recipient)[0] # First mention
recipient: str = self.bot.get_guild(ctx.guild.id)\
.get_member(recipient_id).display_name
else:
recipient: str = discord.utils.escape_mentions(recipient.strip())
with ctx.channel.typing():
compliment: str = await self.util.get_compliment(recipient)
if compliment:
return await ctx.respond(compliment)
return await ctx.respond("Compliment failed :(")
except Exception as e:
traceback.print_exc()
return await ctx.respond(f"Compliment failed :(\nError: {str(e)}")
@bridge.bridge_command(aliases=['whiskey'])
async def whisky(self, ctx, *,