def set_avatar(self, avatar_link : str):
"""Sets bot's avatar
Parameters:
avatar_link: The link of the the picture which will become the new bot's avatar
Example: [p]set_avatar http://i.imgur.com/bjmbH1e.png"""
r = requests.get(avatar_link)
if r.status_code == 200:
try:
await self.bot.edit_profile(avatar=r.content)
await self.bot.say("Done!")
except discord.HTTPException:
await self.bot.say("HTTP Exception")
except discord.InvalidArgument:
await self.bot.say("Wrong image format")
except requests.exceptions.MissingSchema:
await self.bot.say("Invalid URL")
else:
await self.bot.say("Error " + str(r.status_code) + ": The link must be incorrect, " \
+ "make sure the link finishes with `.png`, `.jpg`, `.jpeg`, etc")
评论列表
文章目录