discordware / eris-sharder Goto Github PK
View Code? Open in Web Editor NEWA sharding manager for the JavaScript eris library
License: MIT License
A sharding manager for the JavaScript eris library
License: MIT License
shardCount
defaults to 0 if not specified. If lastShardID
is also not specified, then it defaults to shardCount - 1
, which is -1, and therefore causes errors, issues, and unexpected behaviour. The example at the bottom of the README has this issue.
Eris is supporting Discord stage channels, but eris-sharder still gives errors in the logs.
Branch | Build failing 🚨 |
---|---|
Dependency |
eris
|
Current Version | 0.8.5 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
eris is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
Additions:
closeVoiceConnection()
– leave voice channels by voice connection ID (guild ID) (c68b07f)Fixes:
Client.disconnect()
(4ed20e9)Message.cleanContent
for custom emoji and system messages (eb234f8)oldRole.mentionable
to guildRoleUpdate
event (0e888b4).ogg
files with non-Opus audio tracks (de56b53)The new version differs by 14 commits.
4e229d5
0.8.6
e30f023
Bump ws dependency
5fc5f1a
Prevent command overwriting in CommandClient (#389)
5cd3c2d
Fix PermissionOverwrite docs, lint
0e888b4
Add role.mentionable to guildRoleUpdate (#387)
23ec4da
Remove global reaction ratelimit (#388)
eb234f8
Update Message.cleanContent (fix #377) (#378)
4ed20e9
Send WS close code 1000 on Shard.disconnect() (#383)
0f570be
Change how duplicate presences are detected (#376)
de56b53
Fix OggOpusTransformer for multi-track files (#380)
c68b07f
Added closeVoiceConnection() (#368)
347458f
Add new system messages (#375)
af2619c
Remove ImageSizes array and fix minimum image size
09e420c
Typings: Renamed dynamicIconURL in User to dynamicAvatarURL (#373)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
package.json
files, so that was left aloneIf you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Methods on the IPC class that return promise such as fetchMember
, fetchGuild
, fetchUser
and fetchChannel
are never rejected if no resource is found.
This means that code waiting on such promises can hang indefinitely, even if all clusters have received the message and do not have the requested resource in their cache.
I have two suggestions:
Master
class called ipcTimeout
)null
and if none provide a value other than null
, resolve to null
.This would mean that the code calling the IPC methods would not be waiting indefinitely, and provides a less confusing experience when working with eris-sharder
I am using eris with typescript.
But this library doesn't support typescript.
So I request to add typescript typing files!
Any object I log is [object Object]
, could it be parsed as a proper object when printing?
I.E: console.log({ 1: 2 })
-> { 1 : 2 }
in console.
Right now: console.log({ 1: 2 })
-> [object Object]
in console.
Same for process.send().
I have tried the example, and when spawning 4 shards in 4 clusters (it says in log), it ends up with saying TypeError: Cannot read property '0' of undefined.. The stacktrace is pointed at the util/queue.js line 19 and the colum 30..
When adding files as an array to the createMessage function, files do not display correctly as they contain errors. This happens even though each item in the array is a correct file object that works if sent individually.
Running this function:
msg.channel.createMessage("Some images:", [
{ file: readFileSync("./assets/images/PauseChamp.png"), name: "PauseChamp.png" },
{ file: readFileSync("./assets/images/PagChomp.png"), name: "PagChomp.png" }
]);
Returns this:
If these files are attempted to be downloaded, a webpage displays, "The image cannot be displayed because it contains errors."
if (file && Array.isArray(file)) {
file.forEach(function(f) {
f.file = Buffer.from(f.file, 'base64');
});
};
I was able to find a quick fix that allows both images to be sent. This is by adding the previous lines into the files /src/sharding/clustermanager.js
and /src/structures/SyncedRequestHandler.js
after,
if (file && file.file) file.file = Buffer.from(file.file, 'base64');
and
if (file && file.file) file.file = Buffer.from(file.file).toString('base64');
respectively.
I've been using eris-sharder in a staging-environment for a month or two now, and recently deployed it to production as well. During the staging period, i noticed quite a few shards disconnections, though eris-sharder re-connected almost instantly so it wasn't an issue.
Two days ago however, sometimes when a shard got disconnected, eris-sharder would reconnect like expected but log in twice
(Please ignore the weeb background)
The circled parts are the logs when the ready
event is emitted, as you can see, it is emitted two times.
The resulting issue is that it create two instances of the bot, therefore double commands outputs and such.
After discussing with an other dev using eris-sharder, i learned that they had the same issue, so an issue within my code is unlikely.
So far i could only see the issue happen on staging environment, on a single-sharded bot, the production bot didn't logged in twice (yet, at least).
As it only started happening 2 days ago, i suspect the issue happen when Discord does something wrong and do not properly disconnect the shard, though that's the only lead i have.
If the shardCount is set to 0, then the following if statement results to true allowing the code to run which gets a recommended amount of shards to run. (src/sharding/clustermanager:193
)
if (this.shardCount === 0) {
this.eris.getBotGateway().then(result => {
this.calculateShards(result.shards).then(shards => {
this.shardCount = shards;
this.lastShardID = this.shardCount - 1;
});
});
}
logger.info("Cluster Manager", `Starting ${this.shardCount} shards in ${this.clusterCount} clusters`);
let embed = {
title: `Starting ${this.shardCount} shards in ${this.clusterCount} clusters`
}
this.sendWebhook("cluster", embed);
master.setupMaster({
silent: true
});
// Fork workers.
this.start(0);
However, the code inside of the if statement is asynchronous, which means that the code after the if statement will most likely run before the code inside of the if statement finishes, resulting in the program effectively hanging and returning a message similar to Cluster Manager | Starting 0 shards in 12 clusters
since shardCount is still set to 0. While this may not happen in environments with ultra-fast internet, the chances of this happening are still very likely.
I'm not sure how I want to see this happen, but it'd be useful to be able to provide eris-sharder with an Eris.Client object instead of having to add props to an already connected client.
Cleanup the readme, make it more organized and structured.
npm install airbrake
{
"dependencies": {
"airbrake": "~2.0.0"
}
}
This is the minimal example that you can use to test Node Airbrake with your project.
The common use case for this module is to catch all 'uncaughtException'
events on the process
object and send them to Airbrake (You can find your project ID and API KEY with your project's settings):
var airbrake = require('airbrake').createClient(
'<Your project ID>', // Project ID
'<Your project API KEY>' // Project key
);
airbrake.handleExceptions();
throw new Error('I am an uncaught exception');
Note: the above will re-throw the exception after it has been successfully delivered to Airbrake, causing your process to exit with status 1.
If you want more control over the delivery of your errors, you can also manually submit errors to airbrake:
var airbrake = require('airbrake').createClient(
'<Your project ID>', // Project ID
'<Your project API KEY>' // Project key
);
var err = new Error('Something went terribly wrong');
airbrake.notify(err, function(err, url) {
if (err) throw err;
// Error has been delivered, url links to the error in airbrake
});
For more information please visit our official GitHub repo.
Make any pull requests with any features you would want in eris-sharder and I'll look over it.
Shard 0 | Error: 4000: Unknown error. at Shard._onWSClose (C:\Users\User\Desktop\Eris-Atago\node_modules\eris\lib\gateway\Shard.js:1855:23) at WebSocket.emit (events.js:315:20) at WebSocket.emitClose (C:\Users\User\Desktop\Eris-Atago\node_modules\ws\lib\websocket.js:198:10) at TLSSocket.socketOnClose (C:\Users\User\Desktop\Eris-Atago\node_modules\ws\lib\websocket.js:886:15) at TLSSocket.emit (events.js:327:22) at net.js:674:12 at TCP.done (_tls_wrap.js:567:7)
🚨 You need to enable Continuous Integration on all branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.
I've been trying to install this package and all I keep getting is this error:
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/discordware/eris-sharder.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users...\AppData\Roaming\npm-cache_logs\2020-07-26T13_49_47_630Z-debug.log
Could you please help me fix this or tell me whats up?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.