Answer the question
In order to leave comments, you need to log in
How to pass a JSON dictionary as an argument?
If passed through a regular string, the discord complains about quotes, so now it is passed as literal_eval.
But if you pass it through literal_eval, you need to escape all quotes and \n..
Is it possible to somehow pass a dictionary so that the quotes do not need to be escaped, but the dictionary itself is also passed?
Answer the question
In order to leave comments, you need to log in
Use json.loads function as converter and keyword-only arguments
from json import loads
@commands.command()
@commands.is_owner()
async def test(ctx, *, j: loads):
await ctx.send(f"{type(j)}\n{j}")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question