Giter Site home page Giter Site logo

1kill2steal / serenity-discord-bot Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 187 KB

A discord bot built on top of the serenity-rs & poise-rs Rust frameworks using tokio.

License: Apache License 2.0

Rust 96.58% Dockerfile 2.70% Shell 0.72%
discord-bot

serenity-discord-bot's Introduction

Serenity Discord Bot

Features overview

This is a list of some of the Bots available features. For a more comprehensive list you can always check out the code with all the commands or use the help command.

  • A help command containing all the bot commands.
  • A bunch of embed interaction commands (like pats, hugs and etc.)
  • A levelling system (managed locally). Some people like it, others hate it and say its a MEE6 clone (They kinda have a point there). Nevertheless, you can always use the SQLite database for something else if you need to. There's also a cooldown implementation and periodic cleaning up of the users which aren't under cooldown (This was a bit tricky to do because of the Mutex locking and my overall skill issue).
  • The leveling system has a nice topranks command which gives a cool-looking embed!
  • A bot uptime command.

Setting up

ALL THE RELATIVE PATHS IN THIS DESCRIPTION BASED ON THE ROOT OF THE REPOSITORY!

In order to set up your bot token you can do it manually by creating and modifying the .env file and adding the token in it like this:

BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN_HERE

Alternatively, there's also a script that does the exact same thing! To compile and run it, enter in the following commands:

For Linux;

rustc extra_utils/generate_dotenv.rs -o bin/generate_dotenv

./bin/generate_dotenv

For Windows (Just change / to \);

rustc extra_utils\generate_dotenv.rs -o bin\generate_dotenv

.\bin\generate_dotenv

After you've configured your dotenv (.env) files, you can just run

cargo install sqlx-cli

sqlx database setup

sqlx migrate run

cargo sqlx prepare

cargo run --release

The database setting up is a ONE TIME ONLY thing. From your second run after you just need to do:

cargo run --release

Advanced setting up (Containerization)

I've also provided a Dockerfile in this repo for anyone who wants to build a docker image and run the project like that.

Prerequisites:

After you have the Docker engine you need to run these commands in your terminal (Linux):

docker volume create --name database
docker build -t YOUR_DOCKER_IMAGE_NAME .
docker run -v database:/database -d --env-file .env YOUR_DOCKER_IMAGE_NAME

NOTE: The image building could take some time (this is compiling Rust code after all) so be patient!

Checking your docker images is as simple as:

docker images

There's also a docker-compose.yml configuration if you wish to build the image by using Docker Compose.

docker-compose up -d

You need to install Docker Compose from docker.com/compose/install though.

For Windows installs removing the sudo prefix and using the PowerShell as an administrator should work (according to Google Gemini). If you encounter problems with setting it up on Windows or want to tell me more details on setting it up on there then feel free to chat to me on Discord - 1kill2steal

Additional info

If you want to change your database location, make sure you also change the .env file.

# This line determines where the database is based on the root directory of the repository.
DATABASE_URL=sqlite:database/botdatabase.sqlite

NOTE: The database URL configuration is hard-coded in the extra_utils/generate_dotenv.rs file.

serenity-discord-bot's People

Contributors

1kill2steal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.