Subparser for /communism and /pay commands
CrsiX opened this issue · comments
#37 wants to add /communism stop
and /communism last
. The parser currently does not support this. A better way might be to use a subparser that understands those commands.
However, new communisms can't use the current syntax of /communism <amount> <reason>
. It would require /communism new <amount> <reason>
. Therefore, other options may also be implemented later on (e.g. /communism external +
to increase the external counter of the current communism or /communism forward <username>
to forward the communism to a known MateBotUser, see #7 for this).
Of course, a new parser must also handle /communism help
correctly. The general /help communism
command may contain information how to call it, but it doesn't need to.
If this was implemented successfully, it is no big deal to adopt it to /pay
.
We might need a custom parser. argparse
is not suitable for the follwing purposes (only limited to the important aspects):
/communism
shows the usage string and the short explanation (✅)/communism <amount> <reason>
creates a new communism using the specified amount and reason (✅)*/communism forward <user>
forwards the communism message to the specified user (❌)/communism show
removes the old message of the communism somewhere in the previous chat history and instead creates a new message (with the same content and inline keyboard) (❌)
(Other features like /communism stop
could be easily added later on.)
*As @myOmikron pointed out, the user usually wants simplicity and usability first. Therefore, adding new
as required static word (/communism new <amount> <reason>
) is discouraged.
New custom parser is in development. I will upload my branch soon.
Quick preview:
- A parser can contain multiple "usages"
- Each usage holds its own set of arguments
- When parsing the parser tries which usage can handle the given arguments
It's kind of like having multiple argparse-parser for one command and trying which one applies.
The new parser is here, making this issue outdated.