Add Avatar context menu
This commit is contained in:
parent
c9db7d4529
commit
a4aec6bf60
1 changed files with 15 additions and 8 deletions
|
@ -126,14 +126,6 @@ class UtilCog(Extension):
|
||||||
else:
|
else:
|
||||||
await ctx.send(to_send, ephemeral=True)
|
await ctx.send(to_send, ephemeral=True)
|
||||||
|
|
||||||
@slash_command(name="avatar", description="Get a user avatar")
|
|
||||||
@slash_option(
|
|
||||||
name="user",
|
|
||||||
description="User to view avatar of",
|
|
||||||
opt_type=OptionTypes.USER,
|
|
||||||
required=False,
|
|
||||||
)
|
|
||||||
@cooldown(bucket=Buckets.USER, rate=1, interval=5)
|
|
||||||
async def _avatar(self, ctx: InteractionContext, user: User = None) -> None:
|
async def _avatar(self, ctx: InteractionContext, user: User = None) -> None:
|
||||||
if not user:
|
if not user:
|
||||||
user = ctx.author
|
user = ctx.author
|
||||||
|
@ -198,6 +190,21 @@ class UtilCog(Extension):
|
||||||
)
|
)
|
||||||
await ctx.send(embeds=embed, file=color_show, components=components)
|
await ctx.send(embeds=embed, file=color_show, components=components)
|
||||||
|
|
||||||
|
@slash_command(name="avatar", description="Get a user avatar")
|
||||||
|
@slash_option(
|
||||||
|
name="user",
|
||||||
|
description="User to view avatar of",
|
||||||
|
opt_type=OptionTypes.USER,
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
@cooldown(bucket=Buckets.USER, rate=1, interval=5)
|
||||||
|
async def _avatar_slash(self, ctx: InteractionContext, user: User = None) -> None:
|
||||||
|
await self._userinfo(ctx, user)
|
||||||
|
|
||||||
|
@context_menu(name="Avatar", context_type=CommandTypes.USER)
|
||||||
|
async def _avatar_menu(self, ctx: InteractionContext) -> None:
|
||||||
|
await self._avatar(ctx, ctx.target)
|
||||||
|
|
||||||
async def _userinfo(self, ctx: InteractionContext, user: User = None) -> None:
|
async def _userinfo(self, ctx: InteractionContext, user: User = None) -> None:
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
if not user:
|
if not user:
|
||||||
|
|
Loading…
Add table
Reference in a new issue