curious.commands.decorators¶
Decorators to annotate function objects.
Functions
autoplugin([plugin, startswith]) |
Automatically assigns commands inside a plugin. |
command(*[, name, description, hidden, aliases]) |
Marks a function as a command. |
condition(cbl) |
Adds a condition to a command. |
ratelimit(*, limit, time[, bucket_namer]) |
Adds a ratelimit to a command. |
-
curious.commands.decorators._subcommand(parent)[source]¶ Decorator factory set on a command to produce subcommands.
-
curious.commands.decorators.autoplugin(plugin=None, *, startswith='command')[source]¶ Automatically assigns commands inside a plugin.
This will scan a
Pluginfor functions matching the patterncommand_[parent_]name, and automatically decorate them with the command decorator and subcommand decorators.Parameters: Return type: Returns: The edited plugin.
-
curious.commands.decorators.command(*, name=None, description=None, hidden=False, aliases=None, **kwargs)[source]¶ Marks a function as a command. This annotates the command with some attributes that allow it to be invoked as a command.
This decorator can be invoked like this:
@command() async def ping(self, ctx): await ctx.channel.messages.send("Ping!")
Parameters: - name (
Optional[str]) – The name of the command. If this is not specified, it will use the name of the function object. - description (
Optional[str]) – The description of the command. If this is not specified, it will use the first line of the docstring. - hidden (
bool) – If this command is hidden; i.e. it doesn’t show up in the help listing. - aliases (
Optional[List[str]]) – A list of aliases for this command. - kwargs – Anything to annotate the command with.
- name (