Skip to content

BobaTalks/bobabot

Repository files navigation

Bobabot

Getting started

Fork and then clone

Navigate into project

cd bobabot

Initialize your python virtual environment

NOTE: This is only necessary for new environment setups_

python -m venv venv

Activate the python virtual environment

source venv/bin/activate

Install project dependencies into virtual environment

pip install -r requirements.txt
pip install -r requirements.dev.txt

Creating a discord bot & server

First, create a new server

Enter server settings

Under Community, register your server as a community server

Add a new forum text channel, make the name match your .env variable DISCORD_CHANNEL_NAME

Under the settings for this new channel, add a couple tags. These represent different fields/roles.

# Example Tags
SWE, PM, DS, UI/UX

Additionally, register for a discord developer account and create a new bot application.

Invite your bot to your server with the following set of permissions:

  • Manage Server
  • Manage Channels
  • Send Messages
  • Create Public Threads
  • Manage Messages
  • Embed Links
  • Use Slash Commands

NOTE: Generate a new token under the bot tab and keep it, it will be used later in the .env file

Docker & MongoDB

Ensure Docker is installed

Open Terminal/Command Prompt

Pull MongoDB

docker pull mongo:latest

Start a mongoDB server bound to port 27017 (Or a port of your choosing, provided you update your localhost address in .env later).

docker run -d -p 27017:27017 --name bobabot mongo:latest

To ensure that our port and container are running properly, in the command prompt write:

docker ps

This should return a list of active containers, and under port you will find listed 0.0.0.0:27017 (or your custom port address)

Next, we need to configure our .env file to ensure we connect to the correct container when running our local development server.

Within your repository, create a file named ".env".

From there copy the contents of sample.env into .env, fill in your own unique token and server, and remove the comments.

Running Your Test Environment

Start your docker container (If needed) either from the previous guide, or the docker desktop application.

Navigate to your server folder

cd bobabot/server

Run the server with flask

flask --app routes.py run

Open a separate terminal tab and navigate to your bot folder

cd bobabot/bot

From here, run the bot

python main.py

From here, you should see errors and console output within the terminal tab.

Linting

This project uses Black as formatting guidelines. Pre-commit is used to auto format as users commit their work.

pre-commit run --all-files

Run pre-commit on all files to check current formatting status of the project.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages