Skip to content

Commit dc70acc

Browse files
authored
Merge pull request #211 from Stefouch/feat-sharding
feat: Sharding
2 parents 55371c7 + a997d8d commit dc70acc

File tree

17 files changed

+4631
-12240
lines changed

17 files changed

+4631
-12240
lines changed

.vscode/launch.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,23 @@
2525
{
2626
"type": "node",
2727
"request": "launch",
28-
"name": "Launch Program",
28+
"name": "Launch Bot",
2929
"skipFiles": [
3030
"<node_internals>/**",
3131
"**/q.js"
3232
],
3333
"program": "${workspaceFolder}\\bot.js"
3434
},
35+
{
36+
"type": "node",
37+
"request": "launch",
38+
"name": "Launch Shards",
39+
"skipFiles": [
40+
"<node_internals>/**",
41+
"**/q.js"
42+
],
43+
"program": "${workspaceFolder}\\index.js"
44+
},
3545
{
3646
"type": "node",
3747
"request": "launch",

PRIVACY_POLICY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ With the command `/conf` you can set the default `locale` and `game` for your Di
3434

3535
Typing a command will increment a counter and refresh the last use timestamp in our database. This is the only information that are saved.
3636

37-
The usage statistics are shared with our [Patreon](https://patreon.com/Stefouch) members and [Free League Publishing](https://frialigan.se).
37+
The usage statistics are shared in the form of an annual report with our [Patreon](https://patreon.com/Stefouch) members and [Free League Publishing](https://frialigan.se).
3838

3939
## Questions
4040

41-
If you have any additional questions regarding this document, you can of course reach me on Twitter [@stefouch](https://twitter.com/stefouch) or in the public [Year Zero Worlds](https://discord.gg/RnaydHR) Discord server.
41+
If you have any additional questions regarding this document, you can of course reach me `@stefouch` in the public [Year Zero Worlds](https://discord.gg/RnaydHR) Discord server.

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
web: echo "No web process"
2-
worker: node bot.js
2+
worker: node index.js

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
<a href="https://www.patreon.com/Stefouch">
2020
<img src="https://img.shields.io/badge/donate-patreon-F96854.svg" alt="Patreon">
2121
</a>
22-
<a href="https://twitter.com/stefouch" target="_blank">
23-
<img alt="Twitter: stefouch" src="https://img.shields.io/twitter/follow/stefouch.svg?style=social"/>
24-
</a>
2522
</p>
2623

2724
> **Warning**: **Important Changes!**<br/>
@@ -89,7 +86,6 @@ Contributions, translations, issues and feature requests are welcome!<br/>Take a
8986
### 👤 Stefouch
9087

9188
- **Github:** [@Stefouch](https://github.com/Stefouch)
92-
- **Twitter:** [@stefouch](https://twitter.com/stefouch)
9389
- **Discord:** Stefouch on [Year Zero Worlds](https://discord.gg/RnaydHR)
9490

9591
# ❤️ Sponsoring

count-lines-of-code.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
find ./src -name '*.js' | xargs wc -l

index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const { ShardingManager } = require('discord.js');
2+
const Logger = require('./src/utils/logger');
3+
// const PRODUCTION = process.env.NODE_ENV === 'production';
4+
5+
// First, loads the ENV variables (e.g. bot's token).
6+
// if not in production mode.
7+
// if (!PRODUCTION) {
8+
// require('dotenv').config();
9+
// }
10+
11+
const manager = new ShardingManager('./bot.js', {
12+
totalShards: 'auto',
13+
// token: PRODUCTION ? process.env.DISCORD_TOKEN : process.env.BETA_DISCORD_TOKEN,
14+
// execArgv: ['--trace-warnings'],
15+
// shardArgs: ['--ansi', '--color'],
16+
});
17+
18+
manager.on('shardCreate', shard => Logger.client(`🚀 Launched shard ${shard.id}`));
19+
20+
manager.spawn();

0 commit comments

Comments
 (0)