Easy config module for Discord bots
Project description
discord-config is a Python library to help saving and loading configuration files.
Warning: Still in development, so use with care!
Installation
discord-config is available on PyPI under discord_config:
$ pip install -U discord_config
Or for the latest development version:
$ pip install -U git+https://github.com/nowakcasimir/discord-config.git#egg=discord_config
Basic Example
from discord_config import Settings
# (settings will be saved by default to settings.json, if it is not defined)
settings = Settings()
print (settings)
print (settings.token) #> "...yourtoken..."
print (settings.server_id) #> "123123123"
settings.clear() # Clears the settings
# You can define arbitrary settings to Settings object defaults
settings = Settings(defaults = {
"token": "...yourtoken...",
"botname": "MyDiscordBot",
"joinservers": False,
"idleTimer": 100
})
print (settings)
print (settings.token) #> "...yourtoken..."
print (settings.botname) #> "...MyDiscordBot..."
print (settings.joinservers) #> False
print (settings.idleTimer) #> 100
# Defaults were overwritten
try:
print (settings.server_id)
except Exception as e:
#> AttributeError: 'Settings' object has no attribute 'server_id'
pass
settings.set('id', 'broker')
print (settings.id) #> 100
settings.save() # outputs settings.json by default
settings = Settings() # Now it loads settings.json
print (settings)
settings.clear()
Documentation
See the documentation at https://discord-rnn.neocities.org/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discord_config-0.0.2.tar.gz.
File metadata
- Download URL: discord_config-0.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
542904b5deda56002dc0cc0c28be10a75c98b01a02166876c4d5164ca55ac76c
|
|
| MD5 |
04eb052e5b1c31d82f53e898495cd0cd
|
|
| BLAKE2b-256 |
72f07b65473076b840e1ea4fae9d2ba48541d84c8a68ea159274a110ba40790d
|
File details
Details for the file discord_config-0.0.2-py3-none-any.whl.
File metadata
- Download URL: discord_config-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b51e3ad6dd2b7bc0ee616e9a5ead644714ed07c3c3df1057e645229e9cb5569f
|
|
| MD5 |
e068070e534372ae0f322cd6a23d986a
|
|
| BLAKE2b-256 |
d941631b0911fc955e319efecb87be1f37b7e2cd2a576d1f7d804797e5338ee2
|