misc/add compliment bridge command
This commit is contained in:
34
cogs/misc.py
34
cogs/misc.py
@ -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, *,
|
||||
|
Reference in New Issue
Block a user