Skip to content

Commit 95a8d85

Browse files
authored
merge pull request #42 from matthewflegg/feature/servericon-command
added ~servericon command
2 parents 24c9058 + 19e0fae commit 95a8d85

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

cogs/info/info_commands.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,14 @@ async def avatar_callback(
151151
embed = discord.Embed(title=f"💡 {member.name}'s Avatar")
152152
embed.set_image(url=member.avatar.url)
153153
return await send_embed(is_interaction, embed, ctx)
154+
155+
156+
async def servericon_callback(ctx: discord.Interaction | commands.Context):
157+
is_interaction = isinstance(ctx, discord.Interaction)
158+
159+
if is_interaction:
160+
await ctx.response.defer()
161+
162+
embed = discord.Embed(title=f"💡 {ctx.guild.name}'s Icon")
163+
embed.set_image(url=ctx.guild.icon.url)
164+
return await send_embed(is_interaction, embed, ctx)

cogs/info/prefix_cog/info_cog.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ async def botinfo(self, ctx: commands.Context):
9595
@commands.command()
9696
async def avatar(self, ctx: commands.Context, *, member: discord.Member = None):
9797
"""
98-
💡 Shows a member's avatar. If no member is specified, it shows yours.
98+
💡 Shows a member's avatar.
9999
100-
This will change depending on whether the bot is self-hosted.
100+
If no member is specified, it shows yours.
101101
102102
Usage:
103103
```
@@ -110,6 +110,24 @@ async def avatar(self, ctx: commands.Context, *, member: discord.Member = None):
110110
"""
111111
await avatar_callback(ctx, member)
112112

113+
@commands.command()
114+
async def servericon(self, ctx: commands.Context):
115+
"""
116+
💡 Shows the server's icon.
117+
118+
❓ This command is also available as a slash command.
119+
120+
Usage:
121+
```
122+
~avatar [@member]
123+
```
124+
Or:
125+
```
126+
/avatar [@member]
127+
```
128+
"""
129+
await servericon_callback(ctx)
130+
113131

114132
async def setup(client: commands.Bot):
115133
"""

cogs/info/slash_cog/info_slash_cog.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,24 @@ async def avatar(
116116
"""
117117
await avatar_callback(interaction, member)
118118

119+
@app_commands.command()
120+
async def servericon(self, interaction: discord.Interaction):
121+
"""
122+
💡 Shows the server's icon.
123+
124+
❓ This command is also available as a prefix command.
125+
126+
Usage:
127+
```
128+
~avatar [@member]
129+
```
130+
Or:
131+
```
132+
/avatar [@member]
133+
```
134+
"""
135+
await servericon_callback(interaction)
136+
119137

120138
async def setup(client: commands.Bot):
121139
"""

0 commit comments

Comments
 (0)