lightbulb.internal.utils¶
- class CommandCollection(slash: type[SlashCommand] | None = None, user: type[UserCommand] | None = None, message: type[MessageCommand] | None = None)[source]¶
Collection of commands used internally in the Client to allow commands of multiple types to share the same name.
- put(command: type[CommandBase]) None [source]¶
Add a command to the collection. Automatically places it in the correct attribute. If a second command of the same type is given then it will replace the first command.
- Parameters:
command – The command to add to the collection.
- Returns:
- remove(command: Group | type[CommandBase]) None [source]¶
Remove a command from the collection. Does nothing if the command is not present in this collection.
- Parameters:
command – The command to remove from the collection.
- Returns:
- message: type[MessageCommand] | None¶
The collection’s message command.
- slash: type[SlashCommand] | None¶
The collection’s slash command.
- user: type[UserCommand] | None¶
The collection’s user command.
- non_undefined_or(item: T | UndefinedType, default: D) T | D [source]¶
Return the given item if it is not undefined, otherwise return the default.
- Parameters:
item – The item that may be undefined.
default – The default to return when the item is undefined.
- Returns:
item
ordefault
depending on whetheritem
was undefined.