mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Added joining servers and better message handling
This commit is contained in:
@@ -16,7 +16,7 @@ exports.Channel = function(name, server, type, id, isPrivate){
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
this.isPrivate = isPrivate;
|
||||
this.messages = new List("id", "5000");
|
||||
this.messages = new List("id", 5000);
|
||||
}
|
||||
|
||||
exports.Channel.equals = function(otherChannel){
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
var base = "https://discordapp.com/";
|
||||
var apibase = base + "api";
|
||||
|
||||
exports.API = apibase;
|
||||
|
||||
exports.WEBSOCKET_HUB = "wss://discordapp.com/hub"
|
||||
|
||||
exports.USERS = apibase + "/users";
|
||||
|
||||
@@ -225,4 +225,21 @@ Internal.XHR.getServer = function( token, serverID, callback ) {
|
||||
|
||||
}
|
||||
|
||||
Internal.XHR.acceptInvite = function(token, inviteID, callback){
|
||||
|
||||
console.log(Endpoints.API + "/invite/" + inviteID);
|
||||
|
||||
request
|
||||
.post( Endpoints.API + "/invite/" + inviteID )
|
||||
.set( "authorization", token )
|
||||
.end(function(err, res){
|
||||
if(err){
|
||||
callback(err);
|
||||
}else{
|
||||
callback(null, res.body)
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
exports.Internal = Internal;
|
||||
|
||||
@@ -2,7 +2,7 @@ var User = require( "./user.js" ).User;
|
||||
var List = require( "./list.js" ).List;
|
||||
var PMChannel = require( "./PMChannel.js" ).PMChannel;
|
||||
|
||||
exports.Message = function( time, author, content, channel, id, mentions, everyoneMentioned ) {
|
||||
exports.Message = function( time, author, content, channel, id, mentions, everyoneMentioned, embeds ) {
|
||||
|
||||
if ( !content ) {
|
||||
message = time;
|
||||
@@ -13,6 +13,7 @@ exports.Message = function( time, author, content, channel, id, mentions, everyo
|
||||
id = message.id;
|
||||
mentions = message.mentions;
|
||||
everyoneMentioned = message.mention_everyone;
|
||||
embeds = message.embeds;
|
||||
}
|
||||
|
||||
this.time = Date.parse( time );
|
||||
@@ -22,6 +23,7 @@ exports.Message = function( time, author, content, channel, id, mentions, everyo
|
||||
this.id = id;
|
||||
this.mentions = new List( "id" );
|
||||
this.everyoneMentioned = everyoneMentioned;
|
||||
this.embeds = embeds;
|
||||
for ( x in mentions ) {
|
||||
var _mention = mentions[ x ];
|
||||
this.mentions.add( new User( _mention ) );
|
||||
|
||||
Reference in New Issue
Block a user