You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lot of times a single command plugin actually responds to several sub commands. Right now it's kind of a pain to deal with this, because it means you have to physically check first value of args. For example:
@command('foo')deffoo(client, channel, nick, message, cmd, args):
ifargs[0] =='bar':
# Do the "helga foo bar" sub commandelifargs[0] =='baz':
# Do the "helga foo baz" sub command
The text was updated successfully, but these errors were encountered:
A thought on how this should work. Based on this example:
@command('foo')deffoo(client, channel, nick, message, cmd, args):
ifargs[0] =='bar':
# Do the "helga foo bar" sub commandelifargs[0] =='baz':
# Do the "helga foo baz" sub command
This might work:
@command('abc')@command('foo')deffoo_cmd(client, channel, nick, message, cmd, args):
# This is run if no sub command match@foo_cmd.foo.subcommand('bar')defbar(client, channel, nick, message, cmd, args):
# this would run on 'helga foo bar'@foo_cmd.abc.subcommand('xyz')defxyz(client, channel, nick, message, cmd, args):
# this would run on 'helga abc xyz'
Or this:
@command('abc')@command('foo')deffoo_cmd(client, channel, nick, message, cmd, args):
# This is run if no sub command match@foo_cmd.foo.bardefbar(client, channel, nick, message, cmd, args):
# this would run on 'helga foo bar'@foo_cmd.abc.xyzdefxyz(client, channel, nick, message, cmd, args):
# this would run on 'helga abc xyz'
I'm not sure if it should only be a single level of sub commands, or if unlimited levels should be supported.
A lot of times a single command plugin actually responds to several sub commands. Right now it's kind of a pain to deal with this, because it means you have to physically check first value of
args
. For example:The text was updated successfully, but these errors were encountered: