https://github.com/zerointensity/discobase
Database library using nothing but Discord. PyDis Codejam 2024.
https://github.com/zerointensity/discobase
Last synced: 10 months ago
JSON representation
Database library using nothing but Discord. PyDis Codejam 2024.
- Host: GitHub
- URL: https://github.com/zerointensity/discobase
- Owner: ZeroIntensity
- License: mit
- Created: 2024-07-15T19:19:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-21T02:38:11.000Z (over 1 year ago)
- Last Synced: 2025-04-06T03:51:52.657Z (10 months ago)
- Language: Python
- Homepage: https://discobase.zintensity.dev/
- Size: 5.29 MB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Python Discord Codejam 2024 Submission: Spunky Sputniks
## Installation
### Library
```bash
$ pip install discobase
```
### Demo Bot
You can add the demo bot to a server with [this integration](https://discord.com/oauth2/authorize?client_id=1268247436699238542&permissions=8&integration_type=0&scope=bot), or self-host it using the following commands:
```bash
$ git clone https://github.com/zerointensity/discobase
$ cd discobase/src/demo
$ export DB_BOT_TOKEN="first bot token"
$ export BOOKMARK_BOT_TOKEN="second bot token"
$ python3 main.py
```
## Quickstart
```py
import asyncio
import discobase
db = discobase.Database("My database")
@db.table
class User(discobase.Table):
name: str
password: str
async def main():
async with db.conn("My bot token"):
admin = await User.find(name="admin")
if not admin:
User.save(name="admin", password="admin")
if __name__ == "__main__":
asyncio.run(main())
```
## Documentation
Documentation is available [here](https://discobase.zintensity.dev).
## License
`discobase` is distributed under the `MIT` license.