'Adding emojis with python on discord
im trying to add emojis via discord.py
It keeos saying invalid image type
@client.command()
async def emoji(ctx):
await ctx.guild.create_custom_emoji(name = ('ghostface'), image = (b'ghostface1.png'))
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: Unsupported image type given
Solution 1:[1]
Image should be a bytes-like object not a path, you have to first read it.
Try this:
with open(image_path, "rb") as file:
new_emoji = file.read()
await ctx.guild.create_custom_emoji(name='ghostface', image=new_emoji)
Solution 2:[2]
After reading your question, I believe you could implement an emoji into a string. Results may very based on your version of python, but if your issue is different than what I stated, then please advise me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | EpicGamer_9999 |
