Skip to content

Botomir/Botomir

Repository files navigation

Node.js CI testing Node.js CI linter David David Lines of code Docker Pulls GitHub Discord Uptime Robot ratio (30 days)

Join our Discord server!

Botomir Logo

Botomir

Your friendly neighbourhood Discord Bot.

How to add to your server

Go to this site and click Add to Server.

How to run

  1. Install [nodejs], Botomir requires v12 or higher.
  2. Install Docker on your system
  3. Start up a [mongodb] database
    $ docker run -p 27017:27017 -it -d --name mongo -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=pass mongo
  4. Create the botomir user and grant them permissions on the database
$ docker exec -it mongo bash
  >  mongo -u admin -p
  > use admin
  >  db.createUser({
      user: "bot_account",
      pwd: "bot_test_pass",
      roles: [ { role: "readWrite", db: "discordbot" } ]
    })
  1. Create a discord bot application on https://discord.com/developers/applications
  • collect the client ID, client secret, and application token
  1. Create a spotify application on https://developer.spotify.com/dashboard/applications
  • collect the client ID, and client secret
  1. Copy the template.env file to .env, and set all of the values for those fields.
  2. Install all of the node modules npm ci
  3. Start the application for development npm run dev

Build the Docker image

$ docker build \
   --build-arg VCS_REF=$(git rev-parse -q --verify HEAD) \
   --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
   -t botomir .

Running with Docker

To run Botomir using the provided docker-compose file some environment variables need to be set first in the .env file. A template of this file is provided in the compose.env file.

Then run docker compose up -d to start the database and the botomir application.

Or you can start only the botomir container with the following command. Be sure to set all of the required environment variables.

$ docker run -p 80:8300 \
    -e DISCORD_TOKEN=token \
    .... \
    --name botomir \
    marshallasch/botomir

Stopping the container

The Botomir Docker container can be stopped using the SIGTERM signal:

$ docker kill -s SIGTERM <container name>

Required Permissions

  • manage server
  • change nickname
  • manage nicknames
  • view channels
  • send Messages
  • embedded Links
  • read message history

In order to use any of the bot configuration commands you must have the role botomir-admin assigned to you.

Features

Commands

  • Use command-prompt + help to view all commands.
  • To add a new command you add the command to lib/commands/botCommands.js and a corresponding module.

Reactions

  • You can add functionality for reactions to specified messages under lib/reactions/botReactions.js and a corresponding module.

Backup Messages

  • Each message will be written to MongoDB. Data includes server, channel, author, content, timestamp, and message id.
  • Each Spotify track that is sent to the DISCORD_MUSIC_CHANNEL_ID will be stored in the database.
  • An authenticate token database will also be maintained for Spotify access tokens.
  • You can specify a different schema or database under lib/database.

Deployment

  • This app is deployed to the hobby tier of Heroku. Available 24/7.

Configurations

  • You can specify a string for the command prompt.
  • For the weather command, you can specify a default city and temperature unit.
  • You can specify the Spotify playlist name (the date will get added to the end still) and the playlist description text.
  • You can add privileged roles for which the bot cannot add/remove.

Role permissions

Requires following role permissions

  • Manage server
  • Manage roles
  • Manage channels
  • Manage nicknames
  • Send messages
  • Manage messages
  • Embed Links
  • Attach files
  • Read message history
  • Add reactions

Contact

If you have any questions/requests please feel free to create a new issue.