Skip to content

KhafraDev/Khafra-Bot

Repository files navigation

Khafra-Bot

A multi-purpose bot that enhances Discord.

Commercial Usage

  • Khafra-Bot does not sell access to any content or features. ♥️

Setup

  1. Install dependencies using npm i.
  2. Follow nodesource's guide for running Node.js apps with systemd.
  3. Create a .env file in the root directory and fill in the required values.
  4. Edit the config file.
  • For multiple bot owners, an array can be used, or a single string.
  1. Install Postgres. For Windows:
  2. Create a new user account in Postgres with the same name as specified in the .env file.
    • sudo -u postgres psql
    • CREATE USER [username] WITH PASSWORD '[password]';
    • ALTER USER [username] WITH SUPERUSER;
  3. Run the bot:
    • dev: node --run dev:build && node --run dev:run
    • prod: node --run dev:build && node --run prod:run

Example Config Files:

khafra_bot.service:

[Unit]
Description=Khafra Bot
Documentation=https://example.com
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/var/Khafra-Bot
ExecStart=/root/.volta/tools/image/node/21.7.3/bin/node --disable-proto=throw --env-file=.env build/src/index.mjs
Restart=on-failure

[Install]
WantedBy=multi-user.target

.env:

HERE_WEATHER: string
NASA: string
OWLBOTIO: string | undefined
POCKET_CONSUMER_KEY: string
POCKET_SECRET_KEY: string
POSTGRES_USER: string | undefined
POSTGRES_PASS: string | undefined
TMDB: string
TOKEN: string
WORKER_API_BASE: string | undefined
WORKER_BIBLE_BASE: string | undefined

Migrating Versions

v1.0.9 -> v1.10

  1. npm run v1.10 (dumps the current postgres databases for a few commands to JSON).
  2. npm i better-sqlite3
  3. npm run dev:build && npm run prod:run
  4. Open postgres shell and ALTER TABLE kbGuild ADD COLUMN reactRoleChannel TEXT DEFAULT NULL;
    • Windows tutorial here!
    • Linux: sudo -u postgres psql, \c kb, run the command above, \q.

v1.10 -> v1.11

  1. npm rebuild esqlite if moving to Node v17+

CLI Args

  • --prod (none): runs the bot in production mode
  • --disabled (string[]): disables commands listed

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages