Skip to content

Niewidzialny84/Discord_bot

 
 

Repository files navigation

Discord bot

Chi-chan bot Container

Discord bot written in python using discord.py library, used in a private server.

Docker hub link: here

Running in docker

Using docker compose

Container can be run using provided docker-compose-template.yaml. Simply download this file into a machine or copy paste its content to a yaml file on machine. Change fields depending on template.

version: "3.9"
services:
  Chi-chan:
    image: seker212/discord_bot
    environment:
    # Set this a discord token generated on discord page
      - TOKEN=0
    volumes: 
      # Where audio files from .sound commands should be placed
      - ./audio:/app/audio
      # Where settings folder should be placed 
      - ./settings:/app/settings
      # Where logs will be stored
      - ./logs:/app/logs

Execute this command while in foler with docker-compose.yaml and the container should be up and running.

docker-compose up -d

Using docker commands

How to install

  1. Pull image from docker hub
docker pull seker212/discord_bot
  1. Run the image using
docker run --rm -d -e "TOKEN=<discord app client secret here>" --name <name> seker212/discord_bot:latest

If neccesary docker container can be run with a folder sharded with operating system by to run command parameter

-v <os path>:/app/audio

How to build docker image

docker build -t seker212/discord_bot:latest .

Running normally

How to install

  1. Clone repository from github
git clone https://github.com/seker212/Discord_bot.git
  1. Create and run virtual enviroment
python3 -m venv env
#Linux version
source env/bin/activate
#Windows version
env\Scripts\activate
  1. Install neccesary packages
python -m pip install -r requirements.txt

How to run

To run your virtual enviroment must be enabled and folder settings/ should contain a file named token.txt with the discord secret token. Also file settings.json should be in the same folder with the values specified below.

{
    "log_channel_id": <int: channel id on which logs will be printed>,
    "timezone": <string: any valid timezone e.g "Europe/Warsaw">
}

To run after creating necessary files use this command

python start_bot.py

Token can be also a enviroment variable or passed directly in command

python start_bot.py <discord token here>

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.3%
  • Dockerfile 0.7%