Skip to content

Commit 825e28b

Browse files
author
TimeWaster
committed
Initial commit
1 parent b5ef69f commit 825e28b

20 files changed

+10443
-0
lines changed

.babelrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env"
4+
]
5+
}

.gitignore

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port

.prettierrc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 4,
4+
"singleQuote": true,
5+
"printWidth": 200,
6+
"overrides": [
7+
{
8+
"files": "*.md",
9+
"options": {
10+
"tabWidth": 2
11+
}
12+
}
13+
]
14+
}

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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+
```

config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// General configuration
2+
export default {
3+
botToken: '', // the discord bot token
4+
commandPrefix: '!', // the prefix used for commands defined in the rule files
5+
adminChannelID: '', // the channel where administrative messages (responses.admin) will be sent to
6+
rules: {
7+
// which rule files should be loaded on startup. order is important and as a rule of thumb it should be: policing, commands, everything else
8+
message: ['policing', 'help', 'various'],
9+
messageDelete: [],
10+
},
11+
};

0 commit comments

Comments
 (0)