| | |
Methods defined here:
- __init__(self)
- register(self, command, callback=(), description='No description given', spam_protect=True, spam_protect_attempts=5, spam_protect_action=(<function _kick>,), spam_protect_server=False, alias=(), public_say=False, public_say_prefix=(), private_say=False, private_say_prefix=(), private_say_return_on_success=command_c.CommandReturn.CONTINUE, private_say_return_on_failure=command_c.CommandReturn.CONTINUE, console=False, console_prefix=(), console_return_on_success=command_c.CommandReturn.CONTINUE, console_return_on_failure=command_c.CommandReturn.CONTINUE, server=False, server_prefix=(), server_flags=0, server_return_on_success=command_c.CommandReturn.CONTINUE, server_return_on_failure=command_c.CommandReturn.CONTINUE, log_pre_exec=False, log_post_exec=False, log_spam_protect=False, log_logger=<logging.Logger object>, auth=0, auth_params=(), auth_kwparams={}, auth_failure_callback=(<function _access_denied>,), help_enabled=False, pre_hook=())
- Registers the specified command.
Notes:
Any param that requires an iterable and does not receive one will have the
parameter automatically turned into a tuple. Be careful when using strings, as
they are iterable!
In order to maintain compability with future cmdlib versions I suggest you use
keyword arguments instead of positional arguments.
@command - Name of the command to register
@callback - Iterable of callbacks for this command
@description - Description for this command as registered in
the engine
@spam_protect - Whether to enable spam protection
@spam_protect_attempts - Maximum attempts per second before taking
- action (Default: 5)
@spam_protect_action - Iterable of callables when the user fails the
spam protection checks
@spam_protect_server - Whether to enable spam protection for server
@alias - Iterable of strings to use as command alias
@public_say - Whether to register as public say command
@public_say_prefix - Iterable of strings to use as prefix for
public say commands
@private_say - Whether to register as private say command
@private_say_prefix - Iterable of strings to use as prefix for
private say commands
@private_say_return_on_success - Internal return value of the command on
successful execution (Default: Continue)
@private_say_return_on_failure - Internal return value of the command on
failed execution (Default: Continue)
@console - Whether to register as console command
@console_prefix - Iterable of strings to use as prefix for
console commands
@console_return_on_success - Internal return value of the command on
sucesssful execution (Default: Continue)
@console_return_on_failure - Internal return value of the command on
failed execution (Default: Continue)
@server - Whether to register as server command
@server_prefix - Iterable of strings to use as prefix for
private commands
@server_flags - Flags to use when creating the command (Def:
FCVAR_NONE)
@server_return_on_success - Internal return value of the command on
succecssful execution (Default: Continue)
@server_return_on_failure - Internal return value of the command on
failed execution (Default: Continue)
@log_pre_exec - Whether to log before the command executes
@log_post_exec - Whether to log after the command executes
@log_spam_protect - Whether to log failed spam protection attempts
@log_logger - Logger to use (Default: cmdlib logger)
@auth - Auth type to use:
0 = Disabled
1 = Source Python authentification
@auth_params - Positional parameters passed to the
authentification function
@auth_kwparams - Keyword parameter passed to the
authentification function
@auth_failure_callback - Iterable of callables that will be executed if
authentification fails
@help_enabled - TODO
@pre_hook - Iterable of callables to execute before the
command runs. Only if all return True the
command is executed
Raises KeyError if the command exists
Raises TypeError if one of the callbacks supplied is not callable
- set_spam_protect_delta(self, delta=1)
- Sets the time to use for spam protection.
Your best bet is to leave it at the default.
@delta - Time in seconds (Default: 1)
- unregister(self, command)
- Unregisters the specified command.
@command - The name of the command to unregister
Raises KeyError if the command does not exist
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|