Skip to content

Commit

Permalink
merge pull request #42 from matthewflegg/feature/servericon-command
Browse files Browse the repository at this point in the history
added ~servericon command
  • Loading branch information
v0idzdev authored Apr 10, 2022
2 parents 24c9058 + 19e0fae commit 95a8d85
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
11 changes: 11 additions & 0 deletions cogs/info/info_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,14 @@ async def avatar_callback(
embed = discord.Embed(title=f"💡 {member.name}'s Avatar")
embed.set_image(url=member.avatar.url)
return await send_embed(is_interaction, embed, ctx)


async def servericon_callback(ctx: discord.Interaction | commands.Context):
is_interaction = isinstance(ctx, discord.Interaction)

if is_interaction:
await ctx.response.defer()

embed = discord.Embed(title=f"💡 {ctx.guild.name}'s Icon")
embed.set_image(url=ctx.guild.icon.url)
return await send_embed(is_interaction, embed, ctx)
22 changes: 20 additions & 2 deletions cogs/info/prefix_cog/info_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ async def botinfo(self, ctx: commands.Context):
@commands.command()
async def avatar(self, ctx: commands.Context, *, member: discord.Member = None):
"""
💡 Shows a member's avatar. If no member is specified, it shows yours.
💡 Shows a member's avatar.
This will change depending on whether the bot is self-hosted.
If no member is specified, it shows yours.
Usage:
```
Expand All @@ -110,6 +110,24 @@ async def avatar(self, ctx: commands.Context, *, member: discord.Member = None):
"""
await avatar_callback(ctx, member)

@commands.command()
async def servericon(self, ctx: commands.Context):
"""
💡 Shows the server's icon.
❓ This command is also available as a slash command.
Usage:
```
~avatar [@member]
```
Or:
```
/avatar [@member]
```
"""
await servericon_callback(ctx)


async def setup(client: commands.Bot):
"""
Expand Down
18 changes: 18 additions & 0 deletions cogs/info/slash_cog/info_slash_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,24 @@ async def avatar(
"""
await avatar_callback(interaction, member)

@app_commands.command()
async def servericon(self, interaction: discord.Interaction):
"""
💡 Shows the server's icon.
❓ This command is also available as a prefix command.
Usage:
```
~avatar [@member]
```
Or:
```
/avatar [@member]
```
"""
await servericon_callback(interaction)


async def setup(client: commands.Bot):
"""
Expand Down

0 comments on commit 95a8d85

Please sign in to comment.