I am creating a multifunction bot that can do many things and I want to add a command to change the image of a server but the image that is already predefined for example, this is the code that I have:
@bot.command(pass_context = True)
async def change_icon(ctx):
image = "https://media.discordapp.net/attachments/711356150741991424/940806535842508850/gato_uwu.jpg"
icon = image.read()
await bot.edit_guild(ctx.message.guild, icon=icon)
But I have the problem that it says that
.read cannot read str
And then I can have the image saved to read it? yes, but it is not useful for my case so if someone knows how I can change it with a link I would be grateful in advance
The solution is to add the urllib.request library , and then import it.
from urllib.request import Request, urlopen
The code would be like this: