https://github.com/weibeu/discorddb
A simple database which uses a Discord channel to store data.
https://github.com/weibeu/discorddb
database discord discord-channel
Last synced: about 1 month ago
JSON representation
A simple database which uses a Discord channel to store data.
- Host: GitHub
- URL: https://github.com/weibeu/discorddb
- Owner: weibeu
- License: mit
- Created: 2019-06-09T17:45:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-02-13T16:13:49.000Z (over 3 years ago)
- Last Synced: 2025-02-16T10:55:23.648Z (8 months ago)
- Topics: database, discord, discord-channel
- Language: Python
- Homepage:
- Size: 4.53 MB
- Stars: 24
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DiscordDB
[](https://discorddb.readthedocs.io/en/latest/?badge=latest)A simple database which uses a Discord channel to store data.
### Installation
To install current latest release you can use following command:
```sh
python3 -m pip install DiscordDB
```### Basic Example
```python
from discordDB import DiscordDB
from discord.ext import commandsLOGS = []
DATABASE_CHANNEL_ID = 399397622743564297class MyBot(commands.Bot):
def __init__(self):
super().__init__(command_prefix="!")
self.discordDB = DiscordDB(self, DATABASE_CHANNEL_ID)@commands.command()
async def log(self, ctx, *, text):
data = {
"name": ctx.author,
"text": text
}
_id = await self.discordDB.set(data)
LOGS.append(_id)@commands.command()
async def show_logs(self, ctx):
for _id in LOGS:
data = await self.discordDB.get(_id)
await ctx.send(f"Name: {data.name}, Text: {data.text}")bot = MyBot()
bot.run("TOKEN")
```### Requirements
* discord.py### Documentation
Head over to [documentation] for full API reference.[documentation]: https://discorddb.readthedocs.io/en/latest/