monium.ext package¶
Submodules¶
monium.ext.command module¶
monium.ext.configuration module¶
-
class
Configuration
(file: str)¶ Configuration file handler. Uses the HOCON Configuration syntax.
-
set
(key: str, value, *, auto_save=False)¶ Set config key to value, can use dot notation to access nested keys. Also sets the
modified
variable, so you can see when you have to save.Parameters: - key – Config key with dot notation
- value – Value
- auto_save – Save after set
-
get
(key: str, *, default=None)¶ Get config key, can use dot notation to access nested keys
Parameters: - key – Config key with dot notation
- default – Default value if not found
Returns: Value
-
save
(*, force=False)¶ Save config to file. Does not do anything if not modified, unless ‘force’ is set
Parameters: force – Save even if not modified
-
load
()¶ Loads the config from file.
-
monium.ext.embeds module¶
Some pre-made embeds
-
error_embed
(title: str, description: str = '') → discord.embeds.Embed¶ Returns an embed for an error
Parameters: - title – Embed title
- description – Embed description
Returns: Error embed
Return type:
-
success_embed
(title: str, description: str = '') → discord.embeds.Embed¶ Returns an embed for success
Parameters: - title – Embed title
- description – Embed description
Returns: Success embed
Return type:
monium.ext.permissions module¶
-
class
Permissions
(client: MoniumClient, perm_config: monium.ext.configuration.Configuration)¶ Permission manager
-
has_permission
(user: discord.member.Member, perm: str, *, ignore_owner=False) → bool¶ Checks if the user has the permission. Server owners will always have all permissions.
Parameters: - user – The user to check
- perm – The permission to check
- ignore_owner – Disable the the owner having all permissions
Returns: If the user has the permission or not
Return type:
-
get_with_permission
(perm: str, **kwargs) → List[discord.member.Member]¶ Gets everyone with permission
Parameters: - perm – Permission
- kwargs – Extra keyword arguments for
has_permission
Returns: Members with permission
Return type: List[discord.Member]
-
get_permission
(name: str) → List[str]¶ Get the role names this permission contains
Parameters: name – Permission name Returns: Role names Return type: List[str]
-
permission_exists
(name: str) → bool¶ Check to see if the permission exists
Parameters: name – Permission name Returns: Does the permission exist? Return type: bool
-
add_permission
(name: str, roles: List[str])¶ Adds a permission to the bot. If the permission exists, the bot will not to anything.
Parameters: - name – Permission name
- roles – The role names that will have that permission, also works with the “perm:” and “user:” syntax
-
monium.ext.translation module¶
-
class
Translation
(module: Module)¶ The translation manager
-
default_lang
= ''¶ Default language of this module
-
register_language
(lang_code: str, config_object: monium.ext.configuration.Configuration, *, default=False)¶ Register a language file
Parameters: - lang_code – ISO 639-1 Language code
- config_object –
Configuration
object that stores language data. - default – Set to true if this should be the fallback language when a server asks for a invalid language.
-