Skip to content

Multi-language, multipurpose discord bot created using discord.js, typescript, MongoDB and i18next

License

Notifications You must be signed in to change notification settings

RomaDevWorld/Kozak-BOT

Repository files navigation

Kozak - multi-language, multipurpose discord bot created using discord.js, typescript, MongoDB and i18next

This bot is up and running! Try it!

Featuring:

  • Over 15 commands
  • Advanced logging system
  • Ticket system
  • Private voice channels on your server
  • Online member counter

Folder structure explanation

.env.example - Environment variables example
src/
├── @types/ - TypeScript declaration files
├── commands/ - Discord slash commands
├── components/
│   ├── subcommandGroups/ - Extracted subcommand groups to increase modularity
│   ├── subcommands/ - Extracted subcommands
│   ├── logs/ - Log messages (So called "Audit log messages")
│   ├── buttons/ - Button message component
│   └── context/ - Context menu commands
├── events/ - Discord events
├── functions/ - Reusable code
├── handlers/ - Handlers for commands/buttons/events/etc
├── lib/ - Initialize different services
│   ├── client.ts - Discord client
│   ├── i18next.ts - i18next
│   └── mongodb.ts - MongoDB
├── locales/ - Resources for localization
│   ├── en/
│   ├── uk/
│   ├── fr/
│   └── resources.ts - File to specify available resources
├── schemas/ - Mongoose schemas
└── index.ts - File to run an application

Understanding env variables

DISCORD_TOKEN - Discord application secret token from Discord Developers dashboard | https://discord.com/developers/applications

DISCORD_CLIENT_ID - Discord application ID (Aka. Discord bot id) | https://discord.com/developers/applications

MONGOURL - MongoDB connection string | Probably starts with mongodb:// or mongodb+srv://

DEBUG - Used in dev mode, prints some additional information at runtime

How to run it?

Locally with Node.JS

  1. Install NodeJS runtime
  2. Install Yarn npm i -g yarn
  3. Install Git
  4. Clone source code with git clone git@github.com:RomaDevWorld/Kozak-BOT.git or however you like it
  5. Open cloned directory in terminal, and run yarn install to install the dependencies
  6. Rename .env.example to .env and specify all the necessary values (Like Discord Token or MongoDB url)
  7. Build source code with yarn build
  8. Run the app yarn start

Using Docker

  1. Install Docker engine on your system
  2. Run command below after all the env variables -e:
sudo docker run \
--name bot \
--restart unless-stopped \
-e DISCORD_TOKEN='Your discord bot token' \
-e DISCORD_CLIENT_ID='Your discord bot client id' \
-e MONGOURL='MongoDB connection string'
romadevworld/cossackbot:latest

Docker Compose

  • Requires Docker Engine and Docker Compose Plugin installed

If you prefer using Docker Compose, you can spin up both MongoDB and CossackBot containers with a single command

Clone the entire repo

git clone git@github.com:RomaDevWorld/Kozak-BOT.git

or just docker-compose.yml

wget https://raw.githubusercontent.com/RomaDevWorld/Kozak-BOT/main/docker-compose.yml docker-compose.yml

Open file in a text editor, and change DISCORD_CLIENT_ID and DISCORD_TOKEN

Run this command

docker compose up -d

Then check how bot is doing with docker logs bot

About

Multi-language, multipurpose discord bot created using discord.js, typescript, MongoDB and i18next

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages