Answer the question
In order to leave comments, you need to log in
How to ignore quotes in an argument?
If you pass an argument like this:
async def test(ctx, *, arg):
...
async def testemb(self, ctx, channel: Optional[discord.TextChannel], *, arg: str):
try:
if channel is None:
my_json = arg
if "plainText" in my_json:
emb = discord.Embed.from_dict(my_json)
plainText = my_json['plainText']
await ctx.send(plainText, embed = emb)
else:
emb = discord.Embed.from_dict(my_json)
await ctx.send(embed = emb)
else:
my_json = arg
if "plainText" in my_json:
emb = discord.Embed.from_dict(my_json)
plainText = my_json['plainText']
await channel.send(plainText, embed = emb)
else:
emb = discord.Embed.from_dict(my_json)
await channel.send(embed = emb)
except Exception as e:
print(e)
my_json = arg
emb = discord.Embed(description = f'{arg}', color = 0xdb7dbc)
await ctx.send(embed = emb)
discord.ext.commands.errors.UnexpectedQuoteError: Unexpected quote mark, '"', in non-quoted string
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question