Add avatar command, closes #64
This commit is contained in:
parent
4a08ece729
commit
00da6356ba
1 changed files with 28 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from discord import User
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord_slash import SlashContext, cog_ext
|
from discord_slash import SlashContext, cog_ext
|
||||||
from discord_slash.utils.manage_commands import create_option
|
from discord_slash.utils.manage_commands import create_option
|
||||||
|
@ -88,6 +89,33 @@ class UtilCog(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await ctx.send(to_send)
|
await ctx.send(to_send)
|
||||||
|
|
||||||
|
@cog_ext.cog_slash(
|
||||||
|
name="avatar",
|
||||||
|
description="Get a user avatar",
|
||||||
|
guild_ids=[862402786116763668],
|
||||||
|
options=[
|
||||||
|
create_option(
|
||||||
|
name="user",
|
||||||
|
description="User to view avatar of",
|
||||||
|
option_type=6,
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
async def _avatar(self, ctx, user: User = None):
|
||||||
|
if not user:
|
||||||
|
user = ctx.author
|
||||||
|
|
||||||
|
avatar = user.avatar_url
|
||||||
|
embed = build_embed(
|
||||||
|
title="Avatar", description="", fields=[], color="#00FFEE"
|
||||||
|
)
|
||||||
|
embed.set_image(url=avatar)
|
||||||
|
embed.set_author(
|
||||||
|
name=f"{user.name}#{user.discriminator}", icon_url=avatar
|
||||||
|
)
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(UtilCog(bot))
|
bot.add_cog(UtilCog(bot))
|
||||||
|
|
Loading…
Add table
Reference in a new issue