def getcolour(self, ctx, *, colour_codes):
"""Posts color of given hex"""
await ctx.message.delete()
colour_codes = colour_codes.split()
size = (60, 80) if len(colour_codes) > 1 else (200, 200)
if len(colour_codes) > 5:
return await ctx.send(self.bot.bot_prefix + "Sorry, 5 colour codes maximum")
for colour_code in colour_codes:
if not colour_code.startswith("#"):
colour_code = "#" + colour_code
image = Image.new("RGB", size, colour_code)
with io.BytesIO() as file:
image.save(file, "PNG")
file.seek(0)
await ctx.send("Colour with hex code {}:".format(colour_code), file=discord.File(file, "colour_file.png"))
await asyncio.sleep(1) # Prevent spaminess
评论列表
文章目录