Если передавать аргумент так:
async def test(ctx, *, arg):
...
То кавычки будут игнорироваться, но если перед 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