Giter Club home page Giter Club logo

draftbot's Introduction

Couronne DraftBot

DraftBot is a bot developed in Node.js by @BastLast based on a text adventure game. The story takes place in a medieval world, and the player embodies an adventurer who wants to win a competition launched by the king, to win the princess' hand. To achieve this, he must travel and earn points by going through a lot of danger, including thieves, wilderness, and scary children. Every few hours, the player can get a random event by using the /report command: they interact with a multiple choice system, using reactions below the report. Each choice has multiple issues, which could hurt the character, heal them, or even give them some stuff. During the journey, they earn money, stuff, and points, and can use them to buy potions, stuff or effects in the shop, fight other players, and ascend the leaderboard.


How to launch the bot

Before creating your own instance, please note that you can add the bot to your server through the link available on the bot's discord

If you decide to work on the creation of your own instance of the bot, you are supposed to have a minimum of computer skills. Bot support team will prioritize players of the main instance and will only provide very limited assistance. We will fix bugs you report, but we will not teach you how to code a discord bot.

Please do not copy and paste the commands we provide in this readme without :

  • Understanding the command
  • Replacing the relevant parts with your data
  • Having read the whole document

Only the code available in the "release" tab is considered "stable".

Dev environment setup

For development, we recommend that you run the bot on your computer. This way, you can test your changes without having to build the docker image each time you make a change. However, we still recommend you to use docker for the database, as it is easier to setup and maintain.

We provide all the necessary guides below. If you have any questions, feel free to ask them on our discord server.

Running the bot on your computer. (windows)

  • Install git : https://git-scm.com/download/win
  • Download the bot : git clone https://github.com/BastLast/DraftBot-A-Discord-Adventure
  • Install NodeJS http://nodejs.org/fr/
    • Check package.json for the minimal required version
    • Our docker image is based on node alpine (see the DockerFile for the exact version)
    • We recommend that you use nvm to manage your node versions If you use nvm, you can use nvm install to install the correct version If you don't have nvm already install, you can use npm install -g nvm to install it
  • Install Yarn npm install --global yarn
  • Install the bot : yarn install
  • Install and launch a mariadb database. Keep the credentials for the config file. We provide a tutorial below for this step.
  • Create the config file by copying the file config.default.toml in a new file config.toml
  • Edit the file config.toml with the correct data
  • Launch the bot : yarn start

Here is the same guide for debian based linux distributions (or WSL and git bash on windows)

  • Install git : apt-get install git
  • Download the bot : git clone https://github.com/BastLast/DraftBot-A-Discord-Adventure
  • Install NodeJS apt-get install nodejs
    • Install npm apt-get install npm
    • Check package.json for the minimal required version
    • Our docker image is based on node alpine (see the DockerFile for the exact version)
    • We recommend that you use nvm to manage your node versions If you use nvm, you can use nvm install to install the correct version If you don't have nvm already install, you can use npm install -g nvm to install it
  • Install yarn npm install -g yarn (you may have to install npm and use sudo)
  • Install the bot : yarn install
  • Install and launch a mariadb database. Keep the credentials for the config file. We provide a tutorial below for this step.
  • Create the config file : cp config/config.default.toml config/config.toml
  • Edit the file config.toml with the correct data
  • Launch the bot : yarn start

Updating the bot

  • Be sure to use yarn install and yarn start each time you update the bot.
  • Migrations will run automatically, but be sure to check them as they are created for our database, they may cause issues in yours.

Make sure to have docker installed on your machine. Here is a link to the windows installation guide : https://docs.docker.com/desktop/install/windows-install/ Here is a link to the linux installation guide : https://docs.docker.com/engine/install/ubuntu/

Please follow the "without docker" steps until the yarn install step (you don't need to do it).

Compile the docker image

This step is only necessary if you want to compile the image yourself. You do not need to do this for the bot to work. This is only if you want to deploy your own image to a server. We have a docker hub account, so you may not need to compile the image yourself! You can find it there: https://hub.docker.com/u/draftbot. If you really want to compile it yourself, follow the next step.

In the project folder (previously downloaded with git), run:

docker build . -t draftbot/draftbot

Install a database

First, you will need to create a new folder to store the database data. We recommend you to create a folder outside of the project folder, to avoid any issues with git. Copy the path of this folder, you will need in the following command. This is the "path/to/volumes/mariadb"

Create a docker mariadb database with the following command :

docker run -d --name mariadb -e MARIADB_USER=draftbot -e MARIADB_PASSWORD=secret_password -e MARIADB_ROOT_PASSWORD=super_secret_password -v /path/to/volumes/mariadb:/var/lib/mysql -p 3306:3306 mariadb:latest

or with docker compose :

services:
  mariadb:
    image: mariadb
    container_name: mariadb
    ports:
      - 3306:3306
    volumes:
      - /path/to/volumes/mariadb:/var/lib/mysql
    environment:
      MARIADB_USER: draftbot
      MARIADB_PASSWORD: secret_password
      MARIADB_ROOT_PASSWORD: super_secret_password

You can also just run a local mariadb server, but we recommend you to use docker. If you want more information about how to install mariadb, you can visit their website : https://mariadb.org/download/

Deployment

Building or downloading a docker image of the bot is the recommended way to set up DraftBot in production.

You need to have a config.toml file filled. The config template can be found at config/config.default.toml

Here is the command that will start the DraftBot docker container:

docker run -d --name draftbot -v /path/to/config.toml:/draftbot/config/config.toml:ro -v /path/to/logs:/draftbot/logs draftbot/draftbot

or with docker compose :

services:
  draftbot:
    image: draftbot/draftbot
    container_name: draftbot
    volumes:
      - /path/to/config.toml:/draftbot/config/config.toml:ro
      - /path/to/logs:/draftbot/logs

Screenshots

image

Links

draftbot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

draftbot's Issues

Tops

  • Top
  • TopServ
  • TopWeek
  • Reset du top week

Profile command

Ajouter la description du badge si un utilisateur réagis sur un badge du profil d'un autre joueur ou de lui même.

Core refactor

  • Gestion de la réception des messages privés
  • datasource
  • Gérer la mort du joueur
  • Gérer le levelup
  • Gestion du blocage inter-commande global
  • Transformer la classe progressbar en une fonction

improve dm support

Rework du support dm :

  • Les messages privés sont envoyés dans un salon en lecture seule.
  • Le bot répond automatiquement aux dm pour renvoyer vers les liens utils
  • Changement du statut du bot

Blocage du !drink

La commande drink n'est pas bloquée, par exemple si on fait:
!s, !drink puis on achète la potion du jour elle ne sera pas ajoutée à l'inventaire à cause de la modification concurrente de l'objet.

Guilde 6

Passer le nombre de membres maximal dans une guilde à 6

Bug gd en fight

Si un membre de sa guilde est en fight, on ne peux pas faire de guilddaily et le message d'erreur est bug, indiquant que le joueur est occupé et en fight.

Points de combats régénératifs

Les points de combat ne sont plus rendu immédiatement après un combat mais se régénèrent progressivement avec le temps pour limiter le nombre de combats faisable par le joueur. Les combats amicaux ne sont pas affectés.

Bug blue heart

Les pv en fight (coeurs bleu) sont réduis depuis la derniere maj chez tout le monde, et certain se retrouvent avec 444 pv ou 509 etc

Progress bar crash guild command

Jul 21 22:11:21 Draftbot-1 node[7737]: (node:7737) UnhandledPromiseRejectionWarning: RangeError: Invalid count value
Jul 21 22:11:21 Draftbot-1 node[7737]: at String.repeat ()
Jul 21 22:11:21 Draftbot-1 node[7737]: at global.progressBar (/root/DraftBot-A-Discord-Adventure/src/core/Tools.js:279:33)
Jul 21 22:11:21 Draftbot-1 node[7737]: at GuildCommand (/root/DraftBot-A-Discord-Adventure/src/commands/guild/GuildCommand.js:78:9)
Jul 21 22:11:21 Draftbot-1 node[7737]: at async Function.launchCommand (/root/DraftBot-A-Discord-Adventure/src/core/Command.js:187:9)
Jul 21 22:11:21 Draftbot-1 node[7737]: at async handleMessage (/root/DraftBot-A-Discord-Adventure/src/core/Command.js:97:7)
Jul 21 22:11:21 Draftbot-1 node[7737]: at async Client.onDiscordMessage (/root/DraftBot-A-Discord-Adventure/index.js:112:7)
Jul 21 22:11:21 Draftbot-1 node[7737]: (node:7737) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
Jul 21 22:11:43 Draftbot-1 systemd[1]: Created slice User Slice of root.

cf https://discordapp.com/channels/429765017332613120/448055928105861120/734742723260841995

Bypass bot owner

Ajouter un bypass pour tous les problèmes de permission pour le bot owner.

FightCommand

Mettre à jour la command fight afin d'utiliser le nouveau coeur de la 2.0.0

Bug topweek

Si le 1er du topweek fait la commande topweek il a ⚪ et pas le :first_place:

Integration api top.gg

Donner un badge de manière temporaire (12 heures) aux personnes qui votent pour le bot sur top.gg

Bug emote

Bug d'emote quand on boost sa défense en combat
unknown

Reset compteur GuildDaily

Lorsqu'un joueur effectue une action type report, s'il ne répond pas (Action en attente) et qu'il tente de faire un GuildDaily ce dernier se voit reset son compteur à 22h.

Guilds

  • Guild
  • GuildAdd
  • GuildCreate
  • GuildKick
  • GuildLeave
  • GuildDaily
  • Gestion des blocages des joueurs

Equilibrage items

Equilibrer les items et refactorer la méthode de calcul de la puissance des items.

Problème commande fight

Quand on fait un fight, et qu'il renvoit ça :

❌ | @NonozgYtb Il est impossible de se combattre soi-même ! Trouvez un autre adversaire.

Cela bloque toutes les commandes et il faut cliquer sur la croix rouge du message precedant pour que cela se reset et que tout remarche !

Bug fight command

(node:31686) UnhandledPromiseRejectionWarning: TypeError: undefined is not a function
Jul 10 22:23:01 Draftbot-1 node[31686]: at FightCommand (/root/DraftBot-A-Discord-Adventure/src/commands/player/FightCommand.js:22:16)
Jul 10 22:23:01 Draftbot-1 node[31686]: at async Function.launchCommand (/root/DraftBot-A-Discord-Adventure/src/core/Command.js:187:9)
Jul 10 22:23:01 Draftbot-1 node[31686]: at async handleMessage (/root/DraftBot-A-Discord-Adventure/src/core/Command.js:97:7)
Jul 10 22:23:01 Draftbot-1 node[31686]: at async Client.onDiscordMessage (/root/DraftBot-A-Discord-Adventure/index.js:70:7)
Jul 10 22:23:01 Draftbot-1 node[31686]: (node:31686) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise wh$
Jul 10 22:23:01 Draftbot-1 node[31686]: (node:31686) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero ex$
Jul 10 22:33:08 Draftbot-1 systemd[1]: Stopping DiscordBot...
Jul 10 22:33:08 Draftbot-1 systemd[1]: Stopped DiscordBot.

Upgrade help command

  • Make the help command work with command aliases.
  • Add the invite command
  • Prix création de guilde
  • Typo respawn

Classement des guildes

  • Les guildes ont un score, qui pourra être amélioré principalement grâce à la zone PVE
  • Les joueurs pourront accèder à l'affichage du classement des guildes

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.