Skip to content

muhammad-hamdi/querybot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QueryBot 🤖

A discord bot to answer for you when someone asks about common links or data, add the entry and the bot triggers and sends when it detects the keyword.


From the bot help command

## Querybot help
**Usage:** detects registered keywords in user messages and answers with the mathing stored value
### Available commands
- <help>                :show this dialog
- <add-query>           : add a keyword and value to match in the store
- <show-query single>   : return existing keyword and its stored value
- <show-query all>      : return all keywords and stored values

Setup

DB Setup

-- in your psql console
CREATE DATABASE qbot;
-- connect to the qbot db then run the following
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE TABLE stores (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    key TEXT NOT NULL,
    value TEXT NOT NULL,
    server_id TEXT NOT NULL,
    created_by TEXT NOT NULL,
    created_at      TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at      TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_stores_server ON stores(server_id);
CREATE INDEX idx_stores_user ON stores(created_by);
ALTER TABLE stores ADD CONSTRAINT server_key_unique UNIQUE (server_id, key);

Then install deps and fill in env vars

go install
cp .env.example .env // fill your data

Then run or build

go run .
go build .

Made with

  • DiscordGo
  • PostgresQL

About

A discord bot to detect commonly asked keywords and return stored values per server.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages