Skip to content

Latest commit

 

History

History
92 lines (71 loc) · 2.22 KB

README.md

File metadata and controls

92 lines (71 loc) · 2.22 KB

The Banana Hammock - Discord Bot

Example taken from https://github.com/oceanroleplay/discord.ts-example

Relevant links:

To-do

  1. Determine scope of bot. Integrate within Discord server
  2. Decide Framework. TypeScript, with SQLLite DB
  3. Implement working base bot.
    1. Get a prod bot on Banana Discord
    2. Create and connect SQLLite DB to bot/bot code. (Separate prod/dev dbs?)
  4. Start-to-finish documentation for setup and new devs.
  5. List of commands to implement
  6. Investigate merging with current BrexBot implementation, including potential account ownership/transfer.

Reach in the #bot-development channel in the Discord for questions on joining the project.

Set up the database

The bot uses the Prisma ORM for persistence. By default this uses SQLite.

See the duel commend for database integration examples.

The schema for the Database is stored in the Prisma schema file.

Create the client definition

npx prisma generate

Create a new empty Database for development

npx prisma migrate dev --name init

Open the file with sqlite

sqlite3 prisma/dev.db

For better output in sqlite enable columns and headers. You can also hardcode these settings in the ~/.sqliterc file.

sqlite> .mode column
sqlite> .headers ON

How to run

Docker

Prerequisites:

  • Recent version of Docker

Build the image

docker build -t brexbot .

Create a .env file which contains the bot token

DISCORD_TOKEN=<token>

Start the container

docker run --rm --env-file.env -ti brexbot

Locally

Prerequisites:

  • Node.js >= 16

Install the dependencies

npm install

Export the bot token as an environment variable

# Bash and similar
export DISCORD_TOKEN=<token>
# Powershell 
$Env:DISCORD_TOKEN = "<token>"

Run the bot

npm run start