Git Product home page Git Product logo

discord.io's People

Contributors

adryd avatar alexandernorup avatar chris92de avatar connor4312 avatar gocario avatar ibanner56 avatar izy521 avatar jay072 avatar jerwuqu avatar kodypeterson avatar kyu avatar loganintech avatar luminess avatar mastastealth avatar merghq avatar nipanag avatar nnickey avatar pluttgens avatar qeled avatar retrixe avatar s4n1k avatar sclark39 avatar somerandomowl avatar swadicalrag avatar thecyberronin avatar vincent-p avatar xhip avatar zaza7 avatar zorbing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discord.io's Issues

Crash randomly when in voice channels

TypeError: Cannot read property 'members' of undefined at WebSocket.handleWSMessage (/node_modules/discord.io/lib/index.js:206:31) at emitTwo (events.js:105:20) at WebSocket.emit (events.js:185:7) at Receiver.ontext (/node_modules/ws/lib/WebSocket.js:816:10) at /node_modules/ws/lib/Receiver.js:477:18 at Receiver.applyExtensions (/node_modules/ws/lib/Receiver.js:364:5) at /node_modules/ws/lib/Receiver.js:466:14 at Receiver.flush (/node_modules/ws/lib/Receiver.js:340:3) at Receiver.opcodes.1.finish (/node_modules/ws/lib/Receiver.js:482:12) at Receiver.expectHandler (/node_modules/ws/lib/Receiver.js:457:31)

messageID on message

bot.on('message', function(user, userID, channelID, message, rawEvent) { });
It would be nice if messageID was also returned in this call, if possible. I assume for now I can do that via rawEvent?

More playback options?

Hey devs, I'm currently working on a music bot for Discord using your module.
A small thing I wanted to implement but was unable to was pausing a song (or stream) with your API. Is there any way this can be implemented?

certificate not trusted

Hello, I use this module in 2 almost identical bots. After updating both to 1.2.1 and changing the options.username to options.email, one of them works perfectly (mine), while the one I've made for a client fails on startup with an Error: Certificate not Trusted. I can't seem to find any documentation about the cause of this error or how I can rectify it.

Error When Joining Voice

When I join voice it throws:
udpDiscPacket.writeUIntBE(vData.d.ssrc, 0, 4); ^
TypeError: Object`

My Code:
bot.joinVoiceChannel("149771756792446977", function() {});

Also Using Meteor FYI.

Library crashed

Posted this in discord but would be better to post here.

Stacktrace:

.\node_modules\discord.io\lib\index.js:515
        var args = [message.t.toLowerCase().split("_").map(function(e, i) {
                             ^

TypeError: Cannot read property 'toLowerCase' of undefined
    at emit (.\node_modules\discord.io\lib\index.js:515:24)
    at WebSocket.handleWSMessage (.\node_modules\discord.io\lib\index.js:260:12)
    at emitTwo (events.js:87:13)
    at WebSocket.emit (events.js:172:7)
    at Receiver.ontext (.\node_modules\ws\lib\WebSocket.js:816:10)
    at .\node_modules\ws\lib\Receiver.js:477:18
    at Receiver.applyExtensions (.\node_modules\ws\lib\Receiver.js:364:5)
    at .\node_modules\ws\lib\Receiver.js:466:14
    at Receiver.flush (.\node_modules\ws\lib\Receiver.js:340:3)
    at Receiver.opcodes.1.finish (.\node_modules\ws\lib\Receiver.js:482:12)

Error Logging In

Hello there,

I get this problem while logging in to Discord.

Error POSTing login information: null

This only occurs on discord.io, my another discord.js bot with the same account is working.

Any ideas?
Thanks

Joining voice channel crashes Openshift Application

Hey, so I'm using Openshift to host my NodeJS application. When I try to connect to a voice channel using bot.joinVoiceChannel(ID), it successfully connects for about 3 seconds, and then the bot goes offline. I checked my logs and I find that this error follows every attempt to use joinVoiceChannel:

events.js:141
throw er; // Unhandled 'error' event
^
Error: bind EACCES 0.0.0.0
at Object.exports._errnoException (util.js:874:11)
at exports._exceptionWithHostPort (util.js:897:20)
at dgram.js:213:18
at doNTCallback3 (node.js:452:9)
at process._tickCallback (node.js:358:17)

So I googled this EACCES error, and it seems it's due to not having permission to use a port. I would just try to set up a reverse proxy to open more ports, but it seems that it's binding to 0.0.0.0. I'm guessing this is a default fallback value somewhere in either your code or the code of one of your dependencies. (Though that's just a guess)

Adding a role then removing it is not possible

And vice versa.

If you add a role with bot.addToRole() and then remove it again with bot.removeFromRole(), the API will return an error like Role <roleID> not found for user <userID>

If you do the opposite, it will return <userID> already has the role <roleID>

The thing is: It's not true, obviously....If I let the bot reconnect to the server, I can remove/add the role again.

node-opus error

hey there,

I tried to use discord voice feature, but got this error.

  throw err
  ^

Error: Could not locate the bindings file. Tried:
 → /Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/build/binding.node
 → /Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/build/Debug/binding.node
 → /Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/build/Release/binding.node
 → /Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/out/Debug/binding.node
 → /Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/Debug/binding.node
 → /Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/out/Release/binding.node
 → /Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/Release/binding.node
 → /Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/build/default/binding.node
 → /Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/compiled/4.2.1/darwin/x64/binding.node
    at bindings (/Users/morpig/Documents/coding-dev/node_modules/bindings/bindings.js:88:9)
    at Object.<anonymous> (/Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/node_modules/ref/lib/ref.js:5:47)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/morpig/Documents/coding-dev/node_modules/node-opus/node_modules/ogg-packet/node_modules/ref-struct/lib/struct.js:49:11)
    at Module._compile (module.js:435:26)

any ideas?
Thanks

Updating user permissions deletes them from the server object.

In index.js, currently line 179, there's a missing break statement. This causes the code for GUILD_MEMBER_REMOVE to be run every time we receive a GUILD_MEMBER_UPDATE. Side effect is every time we change a user's permissions they are removed from the server object entirely as if they were kicked.

Get specific guild member

Today you can only get a list of members and not a specific member

Sugestion

DCP.getMember = function(input, callback) {
    this._req('get', "https://discordapp.com/api/guilds/" + input.serverID + "/members/" + input.userID, function(err, res) {
        handleResCB("Could not get member", err, res, callback);
    });
};

Voice not working

Hello there,

I'm just testing some things and got another problem. I tried to use the playAudioFile method, and it throws an error. The bot/user joins the voiceChannel but do nothing. I'm using ffmpeg here.

    bot.joinVoiceChannel("xxx", function() {

    });
    bot.testAudio("xxx", function(streams, err) {
      streams.playAudioFile("loreen.mp3");
      console.log(streams);
      console.log(err);
    });
/Users/morpig/Documents/coding-dev/node_modules/discord.io/lib/index.js:1680
                vWS = vChannels[channel].ws.connection;
                                           ^

TypeError: Cannot read property 'connection' of undefined
    at /Users/morpig/Documents/coding-dev/node_modules/discord.io/lib/index.js:1680:32
    at checkRS (/Users/morpig/Documents/coding-dev/node_modules/discord.io/lib/index.js:359:5)
    at DiscordClient.self.testAudio (/Users/morpig/Documents/coding-dev/node_modules/discord.io/lib/index.js:1572:3)
    at DiscordClient.<anonymous> (/Users/morpig/Documents/coding-dev/discord-proto/spotify.js:23:9)
    at emitOne (events.js:77:13)
    at DiscordClient.emit (events.js:169:7)
    at /Users/morpig/Documents/coding-dev/node_modules/discord.io/lib/index.js:95:17
    at getServerInfo (/Users/morpig/Documents/coding-dev/node_modules/discord.io/lib/index.js:349:3)
    at WebSocket.<anonymous> (/Users/morpig/Documents/coding-dev/node_modules/discord.io/lib/index.js:93:11)
    at emitTwo (events.js:87:13)

Any ideas?
I know it's a test, but maybe some solution ;-)
Thanks

node-opus not working

Hello, I've been trying to get my bot to play some music for the last hour to no avail. It says i need to install the node-opus module but it wont find the module when i try to acquire it.

Here's there error code:
Error requiring module: 'node-opus' { [Error: Cannot find module 'node-opus'] code: 'MODULE_NOT_FOUND' }

Mentions in message?

Calling out a user by "@username" doesn't autogenerate a mention. Is this supported?

Error trying to connect to voice channels

I'm getting the following error in the console when running the mp3 example
/home/vm/DiscordBot/node_modules/discord.io/lib/index.js:473 udpDiscPacket.writeUIntBE(vData.d.ssrc, 0, 4); ^ TypeError: Object �R�
Any ideas what could be causing it? The bot does briefly connect to the channel but it drops out and the app crashes with that error. I'm running this in a virtual machine with Ubuntu Server (latest).

Issue with incoming stream

Hello,

I just recently started using Discord.io. What I would like to do is have my bot listen to the channel. I found this in one of the examples:

bot.joinVoiceChannel(CHANNEL_ID, function() {
    bot.getAudioContext({channel: CHANNEL_ID, stereo: true}, function (stream) {
        stream.on('incoming', function(src, buffer) {
            //Handle a buffer of PCM data.
        });
    });
});

Unfortunately, I keep getting this error:

ReferenceError: vUDP is not defined
    at AudioCB.<anonymous> (\node_modules\discord.io\lib\index.js:1424:4)
    at emitTwo (events.js:106:13)
    at AudioCB.emit (events.js:191:7)
    at _addListener (events.js:226:14)
    at AudioCB.addListener (events.js:270:10)
    at handleStream (\server.js:30:9)

Any help would be appreciated.
Thanks!

Why do I need to know the ID of a server to get access to info?

Take this for example:

{
    "81384788765712384": { //Server ID as property
        "name": "Function & Arg", //Server name
        "id": "66192955777486848" //Server ID
        "owner_id": "66186356581208064", //Owner's ID
        "region": "london", //Voice/Creation region
        "icon": null, //Icon hash
        "joined_at": "2015-08-04T00:56:48.041000+00:00", //Date the client joined
        "large": false, //If server is over 100 members
        "afk_timeout": 300, //Seconds it takes for you to marked as idle
        "afk_channel_id": null //Voice channel you're moved to, should you go idle
        "roles": { //Channel roles
            "66192955777486848": { //Role ID as property
                "position": -1, //Position on the roles menu
                "permissions": 36953089, //Bit-packed permissions
                "name": "@everyone", //Role name
                "managed": false, //Currently unknown
                "id": "66192955777486848", //Role ID
                "hoist": false, //Should users with this role appear above other online members
                "color": 0 //Base16 colors converted to Base10, 0 if no color set.
            },
            ...
        }...
}

Why should I already know the Server ID to get information about a server I'm already connected to? I'd appreciate it if you could either change this to just be an array, as it makes no sense or add an alternative which is an array so I can just loop through them easily instead of having to loop through the properties of the bot.servers and then bot.servers[key] to be able to loop through the servers.

The same goes for everything else that could/should actually be an array like the channels, members, roles etc.

Event emitter leak with 'fileEnd'

I am having an issue where 'fileEnd' is sent multiple times depending on how many files i have played.

If i have the following code:

bot.testAudio({ channel: channelID, stereo: true}, function(stream) {
          stream.playAudioFile('path');
          stream.on('fileEnd', function(){
                    console.log("fileEnd emmited");
           }
});

After the first play it will print "fileEnd emmited" once, After the second it will print it twice, the third time it will print it three times and so on.

Missing pluralized

Hi,

it missed a s to the directMessage from CHANNEL_CREATE line in index.js.
line 103 and 105.

Initial user statuses overwritten with GUILD_MEMBERS_CHUNK message

When discord.io initializes, the presence object received from Discord is used to fill the members property of the bot. This contains online and idle statuses. This part works perfectly.

But after that happens, the GUILD_MEMBERS_CHUNK message is received, containing a complete list of members in the server. The problem is that this list does not have statuses, and discord.io is overwriting each user object with these new user objects that have no status.

var members = message.d.members,
    serverID = message.d.guild_id;
if (!self.servers[serverID].members) self.servers[serverID].members = {};
members.map(function(user) {
    self.servers[serverID].members[user.user.id] = user;
});

As an extra note, shouldn't the bot's ready event be emitted after the full member list is received? Currently, it is not, and this could lead to some unexpected functionality in bots that want to examine the full member list on startup, because they will only see online and idle users.

Connection?

I'm new to discord, so i was wondering how to hook up a bot to a server
(maybe some sample code that works i can try and study?? 👍 )

Thanks!

P.s.
im still learning js
:P

Bot does not update its current voice channel if it is moved manually.

Hello,

This is a minor issue but this is a bit confusing.

Let's suppose we got 2 channels, their respective ID being 10 & 20.

if you call :

bot.joinVoiceChannel(10);

then the bot get manually dragged to channel 20.

If you call :

bot.getAudioContext(10, function (stream) {
    stream.playAudioFile('test.mp3'); 
});

the bot will play music in channel 20.

Shouldn't the bot play music in its current channel or, if a channelID is given, move to it then start playing?

Also, I'm not too sure why it is needed to pass a channelID to :

bot.leaveVoiceChannel(channelID);

as the bot can only join one channel at time.

Thanks.

Crash randomly when in voice channels

TypeError: Cannot read property 'members' of undefined at WebSocket.handleWSMessage (/home/peter/stevie/node_modules/discord.io/lib/index.js:206:31) at emitTwo (events.js:105:20) at WebSocket.emit (events.js:185:7) at Receiver.ontext (/home/peter/stevie/node_modules/ws/lib/WebSocket.js:816:10) at /home/peter/stevie/node_modules/ws/lib/Receiver.js:477:18 at Receiver.applyExtensions (/home/peter/stevie/node_modules/ws/lib/Receiver.js:364:5) at /home/peter/stevie/node_modules/ws/lib/Receiver.js:466:14 at Receiver.flush (/home/peter/stevie/node_modules/ws/lib/Receiver.js:340:3) at Receiver.opcodes.1.finish (/home/peter/stevie/node_modules/ws/lib/Receiver.js:482:12) at Receiver.expectHandler (/home/peter/stevie/node_modules/ws/lib/Receiver.js:457:31)

Audio Problems

Am I missing something or did something change, I have tried both examples to no avail

  var Discord = require('discord.io');
  var fs = require('fs');
  var spawn = require('child_process').spawn;
  var bot = new Discord.Client({
      token: "xxxxxxxxx",
      autorun: true
  });

var voiceChannelID = "123456789",
    file = "ohgod.mp3";

  bot.on('ready', function() {
      console.log(bot.username + " - (" + bot.id + ")");

    bot.joinVoiceChannel(voiceChannelID, function() {
      bot.getAudioContext(voiceChannelID, function (stream) {
        stream.playAudioFile('ohgod.mp3');
      });
    });
  });

I get no audio and

C:\Users\Tom\Documents\NarBot\narbot.js:20
        stream.playAudioFile('ohgod.mp3');
              ^

TypeError: Cannot read property 'playAudioFile' of null
    at C:\Users\Tom\Documents\NarBot\narbot.js:20:15
    at DiscordClient.DCP.getAudioContext (C:\Users\Tom\node_modules\discord.io\lib\index.js:1144:3)
    at C:\Users\Tom\Documents\NarBot\narbot.js:19:11
    at DiscordClient.handlevWSMessage (C:\Users\Tom\node_modules\discord.io\lib\index.js:1811:54)
    at emitTwo (events.js:106:13)
    at WebSocket.emit (events.js:191:7)
    at Receiver.ontext (C:\Users\Tom\node_modules\ws\lib\WebSocket.js:841:10)
    at C:\Users\Tom\node_modules\ws\lib\Receiver.js:536:18
    at Receiver.applyExtensions (C:\Users\Tom\node_modules\ws\lib\Receiver.js:371:5)
    at C:\Users\Tom\node_modules\ws\lib\Receiver.js:508:14

Servers Unavailable?

Whenever I try getting data from "bot.servers" I always get this reply

https://snag.gy/SZEJam.jpg

Is there something I am missing or there have been updates I might have missed?

I use a loop to get all the servers as shown bellow
for (var srvID in bot.servers) { console.log(bot.servers[srvID]); }

Thanks for your time.

Twitch

Hello :)

Any ways to stream twitch music to Discord ?

Thanks :)

Use ES6 and promises.

This isn't an issue, so don't take it as one to begin.

A few of my projects use this library, as part of my latest "embrace eslint, ES6, and promises" project for a lot of these older projects, I would like to spend some time transforming this into es6 internally and using promises for callbacks.

I'd do this work in a fork, and the submit a PR request eventually once it's done, updating status here.

The reason for this issue is to see @izy521's view on using this internally. Thanks!

Hostname/IP doesn't match certificate

Hello there,

I tried to play a music to one of my Voice Channel. When joining the voice channel, I got this error:

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: Hostname/IP doesn't match certificate's altnames: "IP: 128.199.192.225 is not in the cert's list: "
    at Object.checkServerIdentity (tls.js:201:15)
    at TLSSocket.<anonymous> (_tls_wrap.js:1063:29)
    at emitNone (events.js:67:13)
    at TLSSocket.emit (events.js:166:7)
    at TLSSocket._finishInit (_tls_wrap.js:596:8).

I dont know if this error is from discord.io or from youtube-mp3-downloader.

Any ideas?
Thanks

Type Error on Debian - playAudioFile()

When i call playAudioFile() on Debian i get : (but work on Windows)
node_modules/discord.io/lib/index.js:529
udpDiscPacket.writeUIntBE(vData.d.ssrc, 0, 4);
Erreur de syntaxe près du symbole inattendu « vData.d.ssrc, » TypeError: Object

ffmpeg (8:1.0.10-dmo1)
"node-opus": "^0.1.11", "discord.io": "^1.6.5",

[REDACTED]

Sorry i was being stupid!
I removed the original message

Get User's Voice Channel Info

I'm trying to create a way for my bot to join the User that called the action's current channel. I'm not quite sure how to do this using discord.io.

Additionally, is there a way to limit commands to a certain rank?

Bot is Timing Out (keepalive)

Hello,

I just started recently using the discord.io framework, which is pretty great, so thanks for writing it!

One problem that I've immediately noticed is that, after 24+ hours, my bot will stop receiving messages from the Discord server. The only fix is that I completely restart the bot, which reconnects to the server, and all is well.

Not 100% sure why this is, but I suspect that it the keep-alive function (at line 1013?) is not robust enough. Has anyone else experienced this problem? Furthermore, can the bot be configured to automatically reconnect if this occurs?

tags: keep-alive, keepalive, timeout, heartbeat, phantom disconnect

d.io v2

Would be nice if you can put brief updates here on how far you are with version 2.x

joinVoiceChannel failing

Everytime I attempt to join the only voice channel in my server it results in,
Selected channel is not a voice channel: <serverID>

The documentation doesn't explain what the parameter for joinVoiceChannel(channelID, [callback()]) other than a channelID which returns the above message...

I'm quite clueless on trying to get this to work, any suggestions?

Get users in a channel

Hi,

Firstly, thanks for this awesome client.

Aftre searching the documentation for it, I didin't found a method to get connected clients for a specific channel. Does this kind of function exists?

If not, it will be awesome to have it 😄.

Thanks,
Halfman.

Get voice status of users

Get voice information of individual users in active voice channel, specifically their talking status and name, perhaps more if data is available.

Preferred to support this data without the need of Opus or other compiled libraries.

Drag and drop channels / members

There seems to be an issue with dragging and dropping users between channels (As well as reordering channels), but only when using this wrapper. Would this be something that could potentially be worked around or is it just how the electron wrapper works which prevents the drag and drop from completing?

sendMessage callback not always called

if (err || !checkStatus(res)) return console.log("Unable to send message: " + checkError(res, body));
if (typeof(callback) === 'function') return callback(JSON.parse(body));

If sending results in an error, the callback is never called, and thus a bot has no opportunity to react to said error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.