0

I'm trying to make a command as always but i cannot use them with a space in between. This is my code at the moment.

@client.command()
async def cautionsign(ctx, msg):
  embed = discord.Embed(title="Here's your caution sign!")
  embed.set_image(url=f"https://api.popcat.xyz/caution?text={msg}")
  await ctx.send(embed=embed)

For ex if i use

!cautionsign test

it will show a cautionsign with test on it but if i use

!cautionsign test test

it will just show test.

If anyone can help me i'd appreciate it :)

Ocryol
  • 61
  • 8

1 Answers1

0

try using the urllib.parse.quote to properly escape url components. For example...

from urllib.parse import quote
embed.set_image(url=f"https://api.popcat.xyz/caution?text={quote(msg)}")
Alexander
  • 16,091
  • 5
  • 13
  • 29
  • Thank you I tried to do the same thing but i used "{urllib.parse.quote(msg)}" instead of "{quote(msg)}" – Ocryol Jun 19 '22 at 22:55