if statement - Alternatives to if else nesting for command line parsing -
i creating bot take in commands starting !command
have actions poll
or help
. these actions have further options , can variable in number. example: !command poll create somepollurl
if somepollurl omitted, should take default url. (above example of how complicated logic can be.)
currently code have getting nested , hence less readable , difficult maintain. may lead bugs , unexpected loopholes in logic may exploited malicious users.
i wondering if there better ways deal issue code more readable , bug free.
consider using library instead of trying manually. since don't language working in, can't recommend specific library, language uses have 1 (and more one).
Comments
Post a Comment