Add a command to remove bot's avatar (#3757)

* Add a command to remove bot's avatar

* blah
This commit is contained in:
jack1142 2020-04-20 19:40:14 +02:00 committed by GitHub
parent f59e77002b
commit 465812b673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1095,7 +1095,7 @@ class Core(commands.Cog, CoreLogic):
await ctx.bot._config.color.set(colour.value)
await ctx.send(_("The color has been set."))
@_set.command()
@_set.group(invoke_without_command=True)
@checks.is_owner()
async def avatar(self, ctx: commands.Context, url: str = None):
"""Sets [botname]'s avatar
@ -1111,10 +1111,12 @@ class Core(commands.Cog, CoreLogic):
async with session.get(url) as r:
data = await r.read()
else:
return await ctx.send(_("Please upload an attachment or provide an URL link."))
await ctx.send_help()
return
try:
await ctx.bot.user.edit(avatar=data)
async with ctx.typing():
await ctx.bot.user.edit(avatar=data)
except discord.HTTPException:
await ctx.send(
_(
@ -1128,6 +1130,14 @@ class Core(commands.Cog, CoreLogic):
else:
await ctx.send(_("Done."))
@avatar.command(name="remove", aliases=["clear"])
@checks.is_owner()
async def avatar_remove(self, ctx: commands.Context):
"""Removes [botname]'s avatar"""
async with ctx.typing():
await ctx.bot.user.edit(avatar=None)
await ctx.send(_("Avatar removed."))
@_set.command(name="playing", aliases=["game"])
@checks.bot_in_a_guild()
@checks.is_owner()