API: classes¶
classes.structs.Module
¶
Module
¶
Container for a loaded feature module.
Holds metadata (name, description, version, color), the module's interface
returned by its setup()
function, exported commands (text and slash),
guild/user settings, and event listeners registered by the module.
Source code in classes/structs/Module.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
__init__(name, path, description, version, color, logger, init_func, data, commands=None, interfacer=None, settings=None, user_settings=None)
¶
Initialize the module container.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Human‑readable module name. |
required |
path
|
str
|
Absolute/relative filesystem path to the module directory. |
required |
description
|
str
|
Short description of the module purpose. |
required |
version
|
str
|
Semantic version string. |
required |
color
|
str
|
Hex color (used in embeds or UI). |
required |
logger
|
Logger
|
Logger used for this module. |
required |
init_func
|
Callable[[ExtendedClient, Any, Logger], Any]
|
Callable returned by the module's |
required |
data
|
Manifest
|
Parsed manifest describing folders and metadata. |
required |
commands
|
Optional[Dict[str, Dict[str, Any]]]
|
Maps of commands grouped by kind, e.g. {"text": {}, "slash": {}}. |
None
|
interfacer
|
Optional[Any]
|
Arbitrary interface object/dict exported by the module. |
None
|
settings
|
Optional[List[Setting[Any]]]
|
Guild‑scoped settings declared by the module. |
None
|
user_settings
|
Optional[List[Setting[Any]]]
|
Member‑scoped settings declared by the module. |
None
|
Source code in classes/structs/Module.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
add_setting(setting)
¶
Add a guild‑scoped setting declared by the module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
setting
|
Setting[Any]
|
A |
required |
Source code in classes/structs/Module.py
144 145 146 147 148 149 150 |
|
add_user_setting(setting)
¶
Add a member‑scoped setting declared by the module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
setting
|
Setting[Any]
|
A |
required |
Source code in classes/structs/Module.py
152 153 154 155 156 157 158 |
|
initialize(client, module_data)
async
¶
Execute the module’s initialization function.
The init_func
is the callable returned by the module's setup()
and is
responsible for returning the interfacer
(helpers the module exposes).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
ExtendedClient
|
Extended bot client. |
required |
module_data
|
Any
|
Arbitrary data passed from the loader. |
required |
Returns:
Type | Description |
---|---|
None. The |
Source code in classes/structs/Module.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
register_event(event, func)
¶
Record an event listener belonging to this module.
The handler is later removed during unload
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event
|
str
|
Discord.py event name, e.g. |
required |
func
|
Callable
|
Listener callable. |
required |
Source code in classes/structs/Module.py
133 134 135 136 137 138 139 140 141 142 |
|
reload(bot, sync=None, guild_id=None)
async
¶
Reload the module by unloading then re‑wiring commands and events.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bot
|
Bot
|
Discord bot/client instance. |
required |
sync
|
Optional[str]
|
Post‑reload sync mode: |
None
|
guild_id
|
Optional[int]
|
Guild id to sync if |
None
|
Source code in classes/structs/Module.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
unload(bot, sync=None, guild_id=None)
async
¶
Unload this module's commands and events from the bot.
Removes all registered text and slash commands and detaches listeners
previously recorded via register_event
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bot
|
Bot
|
Discord bot/client instance. |
required |
sync
|
Optional[str]
|
Optional post‑unload sync mode: |
None
|
guild_id
|
Optional[str]
|
Guild id to sync if |
None
|
Source code in classes/structs/Module.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
classes.structs.Guild
¶
Guild
¶
Wrapper for a Discord guild with bot-specific data and settings.
Exposes
guild
: the underlying Discord guild objectdata
: the backing database documentsettings
: resolved module settings for this guildpermission_overrides
: parsed permission overridesflags
: feature/behavior flags for the guild
Source code in classes/structs/Guild.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
__init__(client, guild, guild_data, settings)
¶
Create a hydrated Guild wrapper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
ExtendedClient
|
Extended bot client. |
required |
guild
|
Guild
|
Discord guild object. |
required |
guild_data
|
Dict[str, Any]
|
Backing DB document for this guild. |
required |
settings
|
Dict[str, Setting]
|
Map of resolved settings (id → |
required |
Source code in classes/structs/Guild.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
get_setting(setting_id)
¶
Return a setting by id for this guild.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
setting_id
|
str
|
Identifier of the setting. |
required |
Returns:
Type | Description |
---|---|
Optional[Setting]
|
The |
Source code in classes/structs/Guild.py
44 45 46 47 48 49 50 51 52 53 |
|
classes.structs.Member
¶
Member
¶
Wrapper for a Discord member within a guild.
Holds
- the Discord
Member
andUser
objects - the parent
Guild
wrapper - the member profile
data
from the database - resolved user-level
settings
(as declared by modules) flags
for feature toggles or state
Source code in classes/structs/Member.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
display_name
property
¶
Return the preferred display name.
Returns:
Type | Description |
---|---|
str
|
The server nickname ( |
str
|
global username from the |
__init__(client, member, guild, settings, data)
¶
Initialize the member wrapper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
ExtendedClient
|
Extended bot client. |
required |
member
|
Member
|
Discord member object. |
required |
guild
|
Guild
|
Hydrated guild wrapper the member belongs to. |
required |
settings
|
Dict[str, Setting[Any]]
|
Resolved user settings (id → |
required |
data
|
Dict[str, Any]
|
Backing DB document for this member. |
required |
Source code in classes/structs/Member.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
__repr__()
¶
Return a string representation of the Member object.
Source code in classes/structs/Member.py
115 116 117 118 119 |
|
get_setting(key)
¶
Retrieve a user setting value by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
Setting identifier. |
required |
Returns:
Type | Description |
---|---|
Optional[Any]
|
The |
Source code in classes/structs/Member.py
62 63 64 65 66 67 68 69 70 71 |
|
has_flag(flag)
¶
Return whether the member has a specific flag set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flag
|
str
|
Flag key. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the flag is set truthy, otherwise False. |
Source code in classes/structs/Member.py
82 83 84 85 86 87 88 89 90 91 |
|
set_flag(flag, value)
¶
Set or update a flag for this member (in-memory).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flag
|
str
|
Flag key. |
required |
value
|
Any
|
Value to assign. |
required |
Source code in classes/structs/Member.py
93 94 95 96 97 98 99 100 |
|
set_setting(key, value)
¶
Update or insert a user setting in-memory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
Setting identifier. |
required |
value
|
Any
|
New setting value (not persisted yet). |
required |
Source code in classes/structs/Member.py
73 74 75 76 77 78 79 80 |
|
to_dict()
¶
Serialize main member data for diagnostics or persistence.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dict with user id, name, serialized settings and flags. |
Source code in classes/structs/Member.py
102 103 104 105 106 107 108 109 110 111 112 113 |
|
classes.structs.Command
¶
Command
¶
Decorator-style wrapper for a text (prefix) command.
Captures a function and registers it into discord.ext.commands
using the
provided metadata (name, description, aliases).
Source code in classes/structs/Command.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
__call__(func)
¶
Decorator entrypoint to bind the underlying function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
Callable
|
The implementation function. |
required |
Returns:
Type | Description |
---|---|
Command
|
The same |
Source code in classes/structs/Command.py
36 37 38 39 40 41 42 43 44 45 46 |
|
__init__(name, description, how_to_use, aliases=None, logger=None)
¶
Create a command descriptor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Command name (prefix-based). |
required |
description
|
str
|
Short description for help. |
required |
how_to_use
|
str
|
Usage string to display in help. |
required |
aliases
|
Optional[List[str]]
|
Optional list of alternate names. |
None
|
logger
|
Optional[Logger]
|
Optional logger; defaults to a logger named after |
None
|
Source code in classes/structs/Command.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
get_command_function()
¶
Return the bound implementation function.
Raises:
Type | Description |
---|---|
RuntimeError
|
If no function has been bound via the decorator. |
Source code in classes/structs/Command.py
48 49 50 51 52 53 54 55 56 |
|
register(bot)
¶
Register this command with the bot's command registry.
Wraps the original function into a discord.py command callback and attaches it to the bot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bot
|
Bot
|
The Discord bot to register against. |
required |
Source code in classes/structs/Command.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
classes.structs.SlashCommand
¶
SlashCommand
¶
Descriptor for a Discord slash command.
Wraps an app_commands.Command
, optional autocomplete function, and some
visibility flags used by help/registration flows.
Source code in classes/structs/SlashCommand.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
should_appear_in_help
property
¶
Return whether the command should appear in help UIs.
__init__(data, func=None, global_cmd=False, auto_complete_func=None, logger=None, module=None, disabled=False)
¶
Create a slash command descriptor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Command
|
The |
required |
func
|
Optional[Callable[..., Any]]
|
Optional explicit callback; defaults to |
None
|
global_cmd
|
bool
|
Whether it should be synced globally by default. |
False
|
auto_complete_func
|
Optional[Callable[..., Any]]
|
Optional autocomplete callback. |
None
|
logger
|
Optional[Logger]
|
Optional logger; defaults to a name derived from the command. |
None
|
module
|
Optional[str]
|
Owning module name, if applicable. |
None
|
disabled
|
bool
|
If True, the command should not appear or be registered. |
False
|
Source code in classes/structs/SlashCommand.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
register_to_tree(bot_tree)
¶
Register the slash command into a command tree.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bot_tree
|
CommandTree
|
The bot's |
required |
Source code in classes/structs/SlashCommand.py
45 46 47 48 49 50 51 52 |
|
classes.structs.Subcommand
¶
Subcommand
¶
Lightweight descriptor for a dynamic subcommand.
Holds the metadata required to attach a subcommand under a parent group at a later time (via the CommandHandler's deferred processing).
Source code in classes/structs/Subcommand.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
__init__(name, description, callback, parent_name=None)
¶
Create a subcommand descriptor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Subcommand name (leaf). |
required |
description
|
str
|
Short description for help/UX. |
required |
callback
|
Callable
|
Async function that will execute the subcommand. |
required |
parent_name
|
str
|
The parent slash group name this subcommand belongs to. |
None
|
Source code in classes/structs/Subcommand.py
11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
to_app_command()
¶
Convert this descriptor into a Discord app command.
Returns:
Type | Description |
---|---|
Command
|
A constructed |
Source code in classes/structs/Subcommand.py
25 26 27 28 29 30 31 32 33 34 35 |
|
classes.structs.CommandHelp
¶
CommandHelp
¶
Rich, localized help metadata for a command.
Stores per‑language dictionaries with keys such as description
, usage
,
and examples
. Retrieval is language‑aware with a safe fallback to English.
Source code in classes/structs/CommandHelp.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
__init__(name, translations)
¶
Initialize a CommandHelp
descriptor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Command name this help refers to. |
required |
translations
|
Dict[str, Dict[str, Optional[str]]]
|
Mapping of language code → help fields. Expected keys include: - "description": short explanation of what the command does - "usage": usage string - "examples": one or more example invocations Example:: { "en": { "description": "Shows the current XP and level of a user.", "usage": "/xp [user]", "examples": ["/xp", "/xp @User123"] }, "pt": { "description": "Mostra o XP atual e o nível de um usuário.", "usage": "/xp [usuário]", "examples": ["/xp", "/xp @Usuario123"] } } |
required |
Source code in classes/structs/CommandHelp.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
get_translation(language)
¶
Return the help metadata for the requested language.
Falls back to English ("en") if the requested language is not available. Returns an empty dict if neither is present.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
language
|
str
|
BCP‑47/ISO language code (e.g., "en", "pt-BR"). |
required |
Returns:
Type | Description |
---|---|
Dict[str, Optional[str]]
|
A dict including keys such as "description", "usage", and "examples". |
Source code in classes/structs/CommandHelp.py
41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
classes.structs.ObjectFlags
¶
ObjectFlags
¶
In‑memory flags for a Guild or Member domain object.
Provides a thin wrapper to read/write boolean or arbitrary values inside
the object's backing data["flags"]
and to consult defaults from
client.flags.flags
when unset on the object.
Source code in classes/structs/ObjectFlags.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
all
property
¶
Return the full flag map stored on the object (without defaults).
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dict of object‑level flags, or |
__init__(client, obj)
¶
Initialize a flags manager bound to a specific object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
Bot
|
Discord bot client. Expected to expose |
required |
obj
|
Any
|
The domain object (e.g., Guild or Member) holding |
required |
Source code in classes/structs/ObjectFlags.py
14 15 16 17 18 19 20 21 22 23 24 |
|
awaitable_set(flag, value)
async
¶
Set a custom flag on the object (async signature convenience).
Same semantics as set()
, but with an awaitable signature for call sites
that are already async.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flag
|
str
|
Flag key to set. |
required |
value
|
Any
|
Arbitrary value to assign. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the flag was set, False otherwise. |
Source code in classes/structs/ObjectFlags.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
delete(flag)
¶
Delete a custom flag from the object if present.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flag
|
str
|
Flag key to remove. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the flag existed and was removed, False otherwise. |
Source code in classes/structs/ObjectFlags.py
78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
get(flag)
¶
Return the effective value for a flag.
Looks first at the object's data["flags"]
, then falls back to
the global default in client.flags.flags
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flag
|
str
|
Flag key to read. |
required |
Returns:
Type | Description |
---|---|
Any
|
The value set on the object or the default if unset. |
Source code in classes/structs/ObjectFlags.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
has(flag)
¶
Return whether a flag key is recognized by the client.
Note
This checks registration (existence in client defaults), not whether a truthy value is set on the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flag
|
str
|
Flag key to verify. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the flag key is registered, otherwise False. |
Source code in classes/structs/ObjectFlags.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
set(flag, value)
¶
Set a custom flag on the object (synchronous).
Returns False if the flag key is unknown or if the object data is invalid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flag
|
str
|
Flag key to set. |
required |
value
|
Any
|
Arbitrary value to assign. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the flag was set, False otherwise. |
Source code in classes/structs/ObjectFlags.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
classes.structs.Permissions
¶
Permissions
¶
Hierarchical permission override tree with wildcard support.
Stores overrides under dot‑separated paths (e.g., "Role.*", "User.123"). Provides helpers to set nodes, resolve nodes (with optional strict mode), and ensure that intermediate paths exist.
Source code in classes/structs/Permissions.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
__init__(logger, permissions)
¶
Initialize a permission tree wrapper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logger
|
Logger
|
Logger for diagnostic messages. |
required |
permissions
|
PermissionOverrideTree
|
Root permission tree mapping. |
required |
Source code in classes/structs/Permissions.py
26 27 28 29 30 31 32 33 34 |
|
get(permission, strict=False)
¶
Resolve a path to either a terminal node or subtree.
Supports a literal '*' at any level as a wildcard fallback.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
permission
|
str
|
Dot‑separated path to resolve. |
required |
strict
|
bool
|
If True, do not return wildcard fallbacks; only exact matches. |
False
|
Returns:
Type | Description |
---|---|
Optional[Union[OverrideNode, PermissionOverrideTree]]
|
An |
Optional[Union[OverrideNode, PermissionOverrideTree]]
|
or |
Source code in classes/structs/Permissions.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
get_end_node(permission, strict=False)
¶
Resolve to a terminal node only.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
permission
|
str
|
Path to resolve. |
required |
strict
|
bool
|
If True, require exact path (ignore wildcard fallback). |
False
|
Returns:
Type | Description |
---|---|
Optional[OverrideNode]
|
The terminal |
Source code in classes/structs/Permissions.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
get_or_create_path(permission)
¶
Ensure a subtree exists for the provided path and return it.
Creates intermediate namespaces as needed and always returns the dict that represents the final segment (which may then be populated).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
permission
|
str
|
Dot‑separated path for the subtree. |
required |
Returns:
Type | Description |
---|---|
PermissionOverrideTree
|
The mutable mapping for the last segment. |
Source code in classes/structs/Permissions.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
set(permission, result)
¶
Insert or replace a terminal override node at a given path.
Creates intermediate namespaces as needed. If a path segment already points to a terminal node, the operation fails and is logged.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
permission
|
str
|
Dot‑separated path (e.g., "Feature.Admin.Purge"). |
required |
result
|
OverrideNode
|
Terminal override node with |
required |
Source code in classes/structs/Permissions.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
is_end_node(node)
¶
Return True if a permissions tree node is a terminal OverrideNode
.
A terminal node carries the concrete allow
/deny
lists; an internal node
is a nested mapping (another PermissionOverrideTree
).
Source code in classes/structs/Permissions.py
10 11 12 13 14 15 16 |
|
classes.structs.Setting
¶
Setting
dataclass
¶
Represents a setting with metadata and value.
Source code in classes/structs/Setting.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
clone()
¶
Creates a copy of the setting.
Source code in classes/structs/Setting.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
to_dict()
¶
Converts the setting to a dictionary.
Source code in classes/structs/Setting.py
40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
default_save_method(bot, entity_id, setting)
async
¶
Default method to save the value of a setting to the database.
Source code in classes/structs/Setting.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|