ZeroIntensity / discobase

Database library using nothing but Discord. PyDis Codejam 2024.
https://discobase.zintensity.dev/
MIT License
6 stars 0 forks source link
discobase logo

Python Discord Codejam 2024 Submission: Spunky Sputniks


Installation

Library

$ pip install discobase

Demo Bot

You can add the demo bot to a server with this integration, or self-host it using the following commands:

$ 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

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.

License

discobase is distributed under the MIT license.