Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chdb-io/chdb-discord-bot
Discord bot running chdb/ClickHouse queries, powered by Deta.space
https://github.com/chdb-io/chdb-discord-bot
bot chdb clickhouse deta deta-space discord
Last synced: 7 days ago
JSON representation
Discord bot running chdb/ClickHouse queries, powered by Deta.space
- Host: GitHub
- URL: https://github.com/chdb-io/chdb-discord-bot
- Owner: chdb-io
- License: mit
- Created: 2023-07-01T19:48:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-27T14:16:59.000Z (about 1 year ago)
- Last Synced: 2024-07-30T18:05:00.966Z (4 months ago)
- Topics: bot, chdb, clickhouse, deta, deta-space, discord
- Language: Python
- Homepage: https://chdb.dev
- Size: 66.4 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chdb-discord-bot
Serverless bot running SQL queries using [chDB](https://chdb.io) [public servers](https://chdb.fly.dev) or any ClickHouse HTTP/S APIs## Features
- `/ping` - a simple command that tells you the bot's latency.
- `/query [format]` - a command that queries [chDB API](https://chdb.io) (ClickHouse).
- A status message `Listening to /query! | chDB` via [scheduled actions](https://deta.space/docs/en/basics/micros#scheduled-actions).
- And you can easily create and add more commands yourself!## Requirements
- **Discord Application:** Create an app for **FREE** at [Discord Developer Portal](https://discord.com/developers/applications).
- **Deta Space account:** Create an account for **FREE** at [Deta Space](https://deta.space/), username + password.
- **chDB API URL:** Use the public service, or point at your HTTP/S chDB/ClickHouse compatible API..## Running Online
1. Create a new deta.space application:
1. Install the [Space CLI](https://deta.space/docs/en/basics/cli).
2. Clone this repository.
3. Make sure you're in the project folder: `$cd `
4. Create a space app: `$space new`
5. Push the space app: `$space push`
2. Enter the environment variables (Space App Settings ➔ Configuration).
- `DISCORD_APPLICATION_ID` - Your discord app's ID.
- `DISCORD_PUBLIC_KEY` - Your discord app's public key.
- `DISCORD_BOT_TOKEN` - Your bot's token.
- `CHDB_API` - Your ClickHouse HTTP/S API _(optional)_
- _Other environment variables are optional._
4. Set `Interactions Endpoint URL` to `/bot/interactions`.
- This is located in: `https://discord.com/developers/applications/{application_id}/information`
- A Micro URL looks like this: `https://chdbdiscordbot-xxxxxxx.deta.app`
5. Visit `/bot/api/dash/` to register the slash commands for the first time.
- If this fails, use the `register.sh` script with your `DISCORD_APPLICATION_ID` and `DISCORD_BOT_TOKEN`
6. Run `/ping` to make sure it's working! Enjoy!## Test Commands
![chdb-discord-bot](https://github.com/lmangani/chdb-discord-bot/assets/1423657/c0db85ef-0cf6-46ef-91da-d2d42fffabee)
## Powered by Deta.space
This Discord bot is **SERVERLESS** which means it can run for **FREE** and be **ALWAYS online** on [Deta Space](https://deta.space)!Code forked and adapted from [chatgpt-discord-bot](https://github.com/imptype/serverless-chatgpt-discord-bot)
## Links and Resources
- **Deta Space Documentation:** https://deta.space/docs
- **Discohook Discord:** https://discord.gg/xEEpJvE9py
- **Discord API Documentation:** https://discord.com/developers/docs