|
| 1 | +# HomarusBot |
| 2 | + |
| 3 | +A reaction Bot for Discord Servers running on NodeJS that is configured (Programmed) in JavaScript, making it extremely flexible. |
| 4 | + |
| 5 | +## General Info |
| 6 | + |
| 7 | +This Bot is intended to: |
| 8 | + |
| 9 | +- Be used by programmers and therefore has no configuration GUI or Website, all rules are defined in JavaScript code |
| 10 | +- Be run on a Root Server hosted by the user itself |
| 11 | + |
| 12 | +If you don't know what that means then this Bot is not for you. |
| 13 | + |
| 14 | +I will give no support for code that is written by the user itself or concerns the underlying Discord.js project. |
| 15 | + |
| 16 | +This Bot uses the framework Discord.js: [Discord.js](https://discord.js.org/#/) |
| 17 | + |
| 18 | +[Discord.js Documentation](https://discord.js.org/#/docs/main/stable/general/welcome) |
| 19 | + |
| 20 | +Only one Bot can run at a time with the same Bot Token, the start/stop scripts enforce that. |
| 21 | + |
| 22 | +It is best to run the Bot on a Root Server for performance, but it can be run from a private computer. |
| 23 | + |
| 24 | +### Where is what |
| 25 | + |
| 26 | +| Where | What | |
| 27 | +| --------------------------------------------------------- | ----------------------------------------------------- | |
| 28 | +| config.js | The configuration of the Bot | |
| 29 | +| [rules/README.md](rules/README.md) | Rules documentation, please read | |
| 30 | +| start.sh + stop.sh + start-dev.sh | Linux bash scripts to maintain the Server | |
| 31 | +| src/server.js | The underlying code that instantiates the Bot | |
| 32 | +| src/utils/ | General utils | |
| 33 | +| src/handlers | The handlers for different types of Discord.js events | |
| 34 | + |
| 35 | +See the [List of events](https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-channelCreate) for more information. |
| 36 | + |
| 37 | +## Prerequisites |
| 38 | + |
| 39 | +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. |
| 40 | + |
| 41 | +On Linux or OSX "screen" needs to be installed to be able to use the included start/stop scripts. |
| 42 | + |
| 43 | +NodeJS v14 or higher is needed. |
| 44 | + |
| 45 | +## Installation |
| 46 | + |
| 47 | +```bash |
| 48 | +sudo apt install git screen nodejs npm # For distros that don't use apt see your distros help page. |
| 49 | + |
| 50 | +cd /home/directory/you/want/ |
| 51 | +git clone [email protected]:SebiTimeWaster/HomarusBot.git |
| 52 | +cd HomarusBot |
| 53 | +npm install |
| 54 | +``` |
| 55 | + |
| 56 | +It is best to create a seperate user account to run the Bot on. |
| 57 | + |
| 58 | +## Adding the Bot to a Discord Server |
| 59 | + |
| 60 | +- [Setting up a bot application](https://discordjs.guide/preparations/setting-up-a-bot-application.html#creating-your-bot). |
| 61 | +- Open this url in your browser: `https://discordapp.com/oauth2/authorize?client_id=_APPLICATION-ID_&scope=bot&permissions=452672` |
| 62 | + |
| 63 | + "_APPLICATION-ID_" needs to be replaced with the Application ID that was generated under "Setting up a bot application". |
| 64 | + |
| 65 | +- Configure your Bot in `config.js`, don't forget to add the Bot Token (Which is not the same as the Application ID!). |
| 66 | + |
| 67 | +## Start / Stop |
| 68 | + |
| 69 | +```bash |
| 70 | +cd /home/directory/you/want/HomarusBot |
| 71 | +./start.sh |
| 72 | +./stop.sh |
| 73 | +``` |
| 74 | + |
| 75 | +`start-dev.sh` runs the Bot directly in shell with a higher verbosity, only meant for development work. |
| 76 | + |
| 77 | +`log/homarusbot.log` contains the logs from the running Bot or last run of the Bot (not used with `start-dev.sh`). |
| 78 | + |
| 79 | +## Keeping dependencies up-to-date |
| 80 | + |
| 81 | +```bash |
| 82 | +cd /home/directory/you/want/HomarusBot |
| 83 | +./stop.sh |
| 84 | +npm update |
| 85 | +./start.sh |
| 86 | +``` |
0 commit comments