Skip to content

Latest commit

 

History

History
101 lines (64 loc) · 4.21 KB

README.md

File metadata and controls

101 lines (64 loc) · 4.21 KB

HomarusBot

A reaction Bot for Discord Servers running on NodeJS that is configured (Programmed) in JavaScript, making it extremely flexible:

  • React with random reactions
  • Write calculator commands
  • Call your own code instead of reacting with a message
  • Use everything NodeJS has to offer

General Info

This Bot is intended to:

  • Be used by programmers and therefore has no configuration GUI or Website, all rules are defined in JavaScript code
  • Be run on a Root Server hosted by the user itself

If you don't know what that means then this Bot is not for you unfortunately.

I will give no support for code that is written by the user itself or concerns the underlying Discord.js project.

This Bot uses the framework Discord.js: Discord.js

Discord.js Documentation

Only one Bot can run at a time with the same Bot Token, the start/stop scripts enforce that.

It is best to run the Bot on a Root Server for performance, but it can be run from a private computer.

Where is what

Where What
config.js The configuration of the Bot
rules/README.md Rules documentation, please read
start.sh + stop.sh + start-dev.sh Linux bash scripts to maintain the Server
src/server.js The underlying code that instantiates the Bot
src/utils/ General utils
src/handlers The handlers for different types of Discord.js events

See the List of events for more information.

Prerequisites

HomarusBot can be run on any OS, but Linux works best and the included shell scripts only work on Linux, with a bit of luck also on OSX.

On Linux or OSX "screen" needs to be installed to be able to use the included start/stop scripts.

NodeJS v14 or higher is needed.

Installation

sudo apt install git screen nodejs npm # For distros that don't use apt see your distros help page.

cd  /home/directory/you/want/
git clone git@github.com:SebiTimeWaster/HomarusBot.git
cd HomarusBot
npm install

It is best to create a separate user account to run the Bot on.

Adding the Bot to a Discord Server

  • Setting up a bot application.

  • Open this URL in your browser: https://discordapp.com/oauth2/authorize?client_id=APPLICATION-ID&scope=bot&permissions=452672

    "APPLICATION-ID" needs to be replaced with the Application ID that was generated under "Setting up a bot application".

  • Configure your Bot in config.js, don't forget to add the Bot Token (Which is not the same as the Application ID!).

Start / Stop

cd /home/directory/you/want/HomarusBot
./start.sh
./stop.sh

start-dev.sh runs the Bot directly in shell with a higher verbosity, only meant for development work.

log/homarusbot.log contains the logs from the running Bot or last run of the Bot (not used with start-dev.sh).

Including HomarusBot in your own Git repository

It is possible to add HomarusBot to your Git project without forking it, in a directory you see fit in your project run:

git submodule add git@github.com:SebiTimeWaster/HomarusBot.git

This adds HomarusBot as a sub-directory with its own .git configuration/namespace.

Now copy the rules directory and the config.js from the HomarusBot directory one directory above and start to change/use it:

cp -r HomarusBot/rules ./
cp HomarusBot/config.js ./

You still need to run the npm install and other commands from the HomarusBot directory itself, but you can easily write scripts to do that for you from your repository.