Allows your bot created by Discord Bot Maker to take advantage of sharding!
Download the ZIP and extract the files to your Bot Base Folder.
Your Bot folder should look like this:
Once those are in the folder, up at the top where the path is, select everything in there and type cmd and press enter:
In the command window that opens, type node sharded-bot.js
If you want to run it with a linux terminal then instead of running it with bot node.js
you run it node sharded-bot.js
Command [prefix]shardinfo
{
"name": "shardinfo",
"permissions": "NONE",
"restriction": "1",
"_id": "XRenR",
"actions": [
{
"behavior": "1",
"interpretation": "0",
"code": "client.shard && client.shard.fetchClientValues('users.size')\n.then(results => {\n var output = results.reduce(function(accumulator, currentValue){\n return accumulator + currentValue;\n });\n this.storeValue(output, 1 ,\"totalUsers\", cache)\n this.callNextAction(cache)\n}).catch(console.error);",
"storage": "0",
"varName": "",
"name": "Run Script"
},
{
"behavior": "1",
"interpretation": "0",
"code": "client.shard && client.shard.fetchClientValues('guilds.size')\n.then(results => {\n var output = results.reduce(function(accumulator, currentValue){\n return accumulator + currentValue;\n });\n this.storeValue(output, 1 ,\"totalGuilds\", cache)\n this.callNextAction(cache)\n}).catch(console.error);",
"storage": "0",
"varName": "",
"name": "Run Script"
},
{
"channel": "0",
"varName": "",
"message": "There are a total of ${tempVars(\"totalUsers\")} users in \n${tempVars(\"totalGuilds\")} guilds across all shards.\n\nThis command was ran in shard ${(client.shard.id + 1)} and has an id \nof ${(client.shard.id)}.\n\n\nTotal Active Shards: ${client.shard.count}\n",
"storage": "0",
"varName2": "",
"name": "Send Message"
}
]
}
The command above uses these scripts.
Make sure End Behavior is set to Do Not Call Next Action, and Evaluate Text First is selected for interpretation style for all of these scripts
Total Amount Of Users
This script will store all users to a temp variable called totalUsers, There are a total of ${tempVars("totalUsers")} users
client.shard.fetchClientValues('users.size')
.then(results => {
var output = results.reduce(function(accumulator, currentValue){
return accumulator + currentValue;
});
this.storeValue(output, 1 ,"totalUsers", cache)
this.callNextAction(cache)
}).catch(console.error);
Total Amount Of Guilds
This script will store all users to a temp variable called totalGuilds, users in ${tempVars("totalGuilds")} guilds
client.shard.fetchClientValues('guilds.size')
.then(results => {
var output = results.reduce(function(accumulator, currentValue){
return accumulator + currentValue;
});
this.storeValue(output, 1 ,"totalGuilds", cache)
this.callNextAction(cache)
}).catch(console.error);
If you want to do anything across shards. You will need to use client.shard.broadCastEval()
Sorry there currently isn't a Run Script or a Raw Data command to test this with.
Please read the API docs!