abalabahaha / eris Goto Github PK
View Code? Open in Web Editor NEWA NodeJS Discord library
Home Page: https://abal.moe/Eris/
License: MIT License
A NodeJS Discord library
Home Page: https://abal.moe/Eris/
License: MIT License
Custom emojis have been a thing for some time. When, if ever, can we expect to see support for them in Eris? This functionality is in place in many libs, such as discord.js. I also noticed that SnazzyPines made a pull request to implement this, but it was denied. I would really appreciate this functionality as it's something that I feel would be useful.
Discord Docs: https://discordapp.com/developers/docs/resources/guild#emoji-object
discord.js: http://hydrabolt.github.io/discord.js/#!/docs/tag/master/class/Emoji
PR: #70
stream ended
stopped
Stream created
events.js:160
throw er; // Unhandled 'error' event
^
Error: write after end
at writeAfterEnd (_stream_writable.js:166:12)
at VolumeTransformer.Writable.write (_stream_writable.js:217:5)```
Hi,
I've been trying to make a simple music bot with Eris for learning experience. The objective is to have it join a voice channel, play an existing song file, and leave. Joining and leaving the voice channel has been working, but whenever I attempt to play the song the bot crashes.
Here is the code that I'm executing:
voiceConnections[msg.channel.guild.id].playFile("file.mp3");
where voiceConnections is an object containing VoiceConnection objects mapped to guild IDs, and "file.mp3" is an existing mp3 file.
The bot then crashes with this message:
events.js:141
throw er; // Unhandled 'error' event
^
TypeError: Bad argument
at TypeError (native)
at ChildProcess.spawn (internal/child_process.js:274:26)
at Object.exports.spawn (child_process.js:362:9)
at VoiceConnection.playStream (c:\Users\user\WebstormProjects\pomfbot\node_modules\eris\lib\core\VoiceConnection.js:307:36)
at VoiceConnection.playFile (c:\Users\user\WebstormProjects\pomfbot\node_modules\eris\lib\core\VoiceConnection.js:298:14)
at Client.<anonymous> (c:\Users\user\WebstormProjects\pomfbot\pomf.js:83:56)
at emitOne (events.js:77:13)
at Client.emit (events.js:169:7)
at Shard.wsEvent (c:\Users\user\WebstormProjects\pomfbot\node_modules\eris\lib\core\Shard.js:319:33)
at WebSocket.<anonymous> (c:\Users\user\WebstormProjects\pomfbot\node_modules\eris\lib\core\Shard.js:953:34)
I know for sure that the issue isn't finding the file, because if I tell it to play a nonexisting file it crashes with an ENOENT error.
I have all the necessary libs, such as node-gyp, node-opus, and ffmpeg. I have installed Eris without the --no-optional
tag. I will be more than happy to provide any additional information.
Thank you for your time,
Ratismal
Property added to shards that gives the current status of the shard, wheather its disconnected, errored, connected, ect
If playStream
is called immediately following the ending of another stream, the second stream's end event will be emitted immediately. I used VoiceConnection#stopPlaying
to end the first event, and played the second stream upon receiving the first streams end event.
Could be related to #68.
Possible workaround is to set voiceDataTimeout to a large number or -1.
Both streams are emitting their end event at this line
From my testing (which could be borked) this line is false
the first time because this.playing
is false
. It's false the second time because buffer
is null
.
When you revoke a role, the roles uncache themselves.
Would be nice to see support for case-insensitive commands such as !command
, !Command
, !COMMAND
, etc. maybe by default or via a flag under the command options param.
I'd assume this would mean other things that should be null are not too.
While the bot is in the channel, if the region is switched, it reconnects and restarts playback fine. Around 30 seconds later, the voice connection spontaneously disconnects.
Currently, if a message is deleted but not cached, eris just calls the messageDelete event with undefined as value.
Can this be changed to supplying just the id as string or nested in a "Message"-Like object?
The PermissionOverwrite object (From GuildChannels) should not only contain a .has method, but also a permission number. Would help out a lot.
(Example: msg.channel has a method to set the permissions number for the (dis)allowed perms, but the property permissionOverwrites doesn't hold the permissions number.)
Adding a restriction to a command in the generator, such as {requirements : { "userIDs": ["139412744439988224"] }}
, prevents these commands from working in a group message and Private Messages. These same commands work perfectly well in a regular channel.
Here's an example command:
bot.registerCommand("prune", (msg, args) => {
var msgCount = parseInt(args);
bot.getMessages(msg.channel.id, 100)
.then((messages) => {
var filtered = messages.filter(m=> m.author.id === bot.user.id);
filtered.length = msgCount+1;
filtered.map((msg, i) => bot.deleteMessage(msg.channel.id, msg.id));
});
}, {requirements : { "userIDs": ["139412744439988224"] }});
This command does not work in PM/GM but works in a channel.
Permission checks will always be skipped unless requirements.userIDs
is provided.
https://github.com/abalabahaha/eris/blob/master/lib/command/Command.js#L124-126
if(!this.permissionCheck(msg)) {
return;
}
https://github.com/abalabahaha/eris/blob/master/lib/command/Command.js#L80-82
if(this.requirements.userIDs.length === 0 || ~this.requirements.userIDs.indexOf(msg.author.id)) {
return true;
}
this.requirements.userIDs.length === 0
is true by default, triggering the return true
, meaning that !this.permissionCheck(msg)
is false, causing the permission check to be skipped and the command is executed without ever even checking the other requirements... oops.
As of a few hours ago my selfbot stopped readying up. No change in code or anything, it just stopped.
Two other bots on the same connection and using the same library work fine. If I change the self tag and use a bot token on the code, it works. Ran an empty bot with only the ready
event but nothing happend.
After a while I get this error [Error: Existing connection detected]
Possible issue with self bots?
client.editSelf({username: 'Test'})
removes the bot's avatar.
This can be fixed by adding , avatar: client.user.avatar
, but idk if it's intended to work that way.
If the client is a CommandClient
, message
should contain a boolean called command
. True if it's a registered command and false if it's not.
The selfbot option is not documented
https://github.com/abalabahaha/eris/blob/master/lib/Client.js#L87
In dev branch the VoiceConnection object returned from client.joinVoiceChannel
will have voiceConnection.playing
set to true even though nothing is currently playing.
Issue is likely with this line.
Per the package.json opusscript
is optional however when using eris 0.3.0 you get the error below:
1:14:47 PM web.1 | module.js:442
1:14:47 PM web.1 | throw err;
1:14:47 PM web.1 | ^
1:14:47 PM web.1 | Error: Cannot find module 'opusscript'
1:14:47 PM web.1 | at Function.Module._resolveFilename (module.js:440:15)
1:14:47 PM web.1 | at Function.Module._load (module.js:388:25)
1:14:47 PM web.1 | at Module.require (module.js:468:17)
1:14:47 PM web.1 | at require (internal/module.js:20:19)
1:14:47 PM web.1 | at Object.<anonymous> (/Users/nandub/development/source/discord-webhook/node_modules/eris/lib/voice/VoiceConnection.js:10:20)
1:14:47 PM web.1 | at Module._compile (module.js:541:32)
1:14:47 PM web.1 | at Object.Module._extensions..js (module.js:550:10)
1:14:47 PM web.1 | at Module.load (module.js:458:32)
1:14:47 PM web.1 | at tryModuleLoad (module.js:417:12)
1:14:47 PM web.1 | at Function.Module._load (module.js:409:3)
1:14:47 PM web.1 | module.js:442
1:14:47 PM web.1 | throw err;
When a message is updated, the editedTimestamp is undefined (as in the parent). This is because of line ~117 in /lib/core/Message.js:
this.editedTimestamp = !data.edited_timestamp ? Date.parse(data.edited_timestamp) : this.editedTimestamp;
If the edited_timestamp is undefined, it will be parsed. This timestamp is always undefined if the message is created, and an integer if the message was edited, so on edit, the code will take the original undefined value again.
Removing the ! negation gives a correct editedTimestamp.
TypeError: Cannot read property 'shard' of undefined
at PrivateChannel.createMessage
Steps to replicate?
Steps to reproduce;
Make a basic playlist system, queue up to 2-5 songs, sometimes 2nd-3rd song works, but after that, it just randomly stops. Changing inlineVolume back to false fixes this.
editedTimestamp
returns a Date String but is supposed to return a Number like timestamp
https://github.com/abalabahaha/eris/blob/master/lib/core/Message.js#L117
https://github.com/abalabahaha/eris/blob/master/lib/core/Message.js#L27
No error is thrown, but no message is sent either. I've tried this is with tables and arrays.
new CommandClient("token", {}, {
ignoreBots: false
})
When the above is set and a webhook bot sends command message, the bot crashes with the following error message.
events.js:160
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'roles' of undefined
at Command.permissionCheck (/Users/aalonso128/Desktop/azoy/node_modules/eris/lib/command/Command.js:116:65)
I'm assuming this happens because the webhook bot's msg has member: undefined
At the moment, the userIDs
requiement in both defaultCommandOptions
and in a registerCommand function are being ignored.
defaultCommanOptions being defined as such:
prefix: "/",
ignoreSelf: false,
defaultHelpCommand: false,
defaultCommandOptions: {requirements : { "userIDs": ["139412744439988224"] }}
});
And in a specific command:
bot.registerCommand("ping", "Pong!", { // Make a ping command
// Responds with "Pong!" when someone says "!ping"
description: "Pong!",
fullDescription: "This command could be used to check if the bot is up. Or entertainment when you're bored."
}, {requirements : { "userIDs": ["139412744439988224"] }});
idk if 3 is not supported or what
I got blocked on discord.js repo by you, and I don't know why. You limited the conversation to collaborators as soon as I tried to post that it worked. What happened and why did you do this?
This is happening to some users, no idea how widespread the issue is.
this.client.getDMChannel(user.id)
.then(channel => this.sendMessage(channel, text))
.catch(err => this.logger.error(err));
/users/{user-id}
is now a thing bots can use, which retrieves a user object with properties username
, id
, discriminator
, and avatar
.
the library attempts to run JSON.parse() on a readable-stream passed in the file parameter of sendMessage. It would then try and create a buffer from the result if that succeeded.
bot.joinVoiceChannel(config.voicechannel_id).catch((error) => { bot.editMessage(config.textchannel_id, sentMessage.id, ":warning: |
ERROR| Error joining voice channel, check console!"); console.log("VOICE CHANNEL JOINING ERROR: " + error.message); return; }).then((connection) => {
Doesn't seem to join the channel, works in 0.2.0 but not in dev.
If you have the prefix in the CommandClient
set to anything including @mention
it won't work if the bot has a nickname on that guild.
ownerID String The user ID to transfer server ownership to (bot user must be owner)
should be changed.
XKCD-style invite codes are no longer support in Discord - the option is ignored in the API and it returns the new short-style invite codes.
createInvite() option options.xkcdpass
should be removed.
bot.registerCommand("PING", "Pong", {caseInsensitive: true});
command works with all uppercase, but the lowercase ping does not work. Command label must be in all lowercase.
Hi,
Whenever I ban a user on the latest dev build, my bot crashes with this error:
path\to\node_modules\eris\lib\rest\RequestHandler.js:122
this.ratelimits[url].latency = latency;
^
TypeError: Cannot set property 'latency' of undefined
at IncomingMessage.__dirname.request.req.once.resp.once.err (path\to\node_modules\eris\lib\rest\RequestHandler.js:122:50)
at IncomingMessage.g (events.js:286:16)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:973:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
Any fix would be greatly appreciated.
The
in the description of nick has a typo of THe
Hi,
I've been using this library's voice capabilities, and was wondering if it would be possible to modify the volume of a VoiceConnection? As VoiceConnection#playRaw() already iterates through the stream, I believe it would be possible to modify the buffer there by a volume variable before emitting it to discord. This would save users from having to implement methods to modify their streams beforehand. I hope you consider adding this. Thank you for your time.
Sincerely,
ratismal (stupid cat)
After updating from dev uptime
and ready
never get updated after connection.
Hi,
I'm having an issue with VoiceConnection#playFile
where it doesn't play the entire file. For example, if I play a 11 second file, it gets cut off after 6 seconds. I'm using the latest dev build.
It would be nice to set default command options. For instance, setting default requirements
(useful for selfbot or admin bots), or serverOnly
. Something like:
bot.setDefaultOptions({
requirements : { "userIDs": ["139412744439988224"] },
serverOnly: true;
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.