Configuration¶
How to Config¶
It is possible to config CommandsManager when creating the instance.
mgr = CommandsManager(config={
"text_general_response": "Yes, Sir!"
})
# Or
mgr = CommandsManager(
text_general_response = "Yes, Sir!"
)
Configuration Reference¶
-
class
command4bot.Config(*args, **kwargs)¶ Config dict for
ComamndsManager-
command_case_sensitive: bool¶ Whether command registration and invoking case sensitive
Default to
True
-
command_context_ignore: Iterable[str]¶ Do not regard these parameters of command handlers as context names (a.k.a dependencies)
Default to
(). These parameters are to receive extra context passed toCommandsManager.exec()
-
command_parameter_ignore: Iterable[str]¶ Ignore these parameters of command handlers when constructing keyword arguments to pass
Default to
("self",). The manager will never try to pass these parameters to the handler
-
command_payload_parameter: str¶ The payload parameter name of command handlers
Default to
"payload"
-
enable_default_fallback: bool¶ Whether to enable default fallback handler.
The default fallback handler returns similar command help or a general response
-
text_command_closed: str¶ What to return if target command handler is closed.
Default to
"Sorry, this command is currently disabled."
-
text_general_response: str¶ For default fallback handler
Command4bot.help_with_similar().Default to
"Copy! But the bot can't understand it."What to return if neither exact nor similar command handlers found for the input
-
text_possible_command: str¶ For default fallback handler
Command4bot.help_with_similar().Default to
"Did you misspell it? Possible commands are:"What to say before a list of command helps if only similar command handlers foundfor the input
-