Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord.js

Package Overview
Dependencies
Maintainers
1
Versions
1738
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord.js - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

42

lib/Client.js

@@ -42,3 +42,3 @@ //discord.js modules

this.websocket = null;
this.events = new Map();
this.events = {};
this.user = null;

@@ -86,8 +86,8 @@ this.alreadySentData = false;

value: function on(event, fn) {
this.events.set(event, fn);
this.events[event] = fn;
}
}, {
key: "off",
value: function off(event, fn) {
this.events["delete"](event);
value: function off(event) {
this.events[event] = null;
}

@@ -112,3 +112,3 @@ }, {

}
var evt = this.events.get(event);
var evt = this.events[event];
if (evt) {

@@ -329,4 +329,4 @@ evt.apply(this, args.slice(1));

key: "reply",
value: function reply(destination, message) {
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (err, msg) {} : arguments[2];
value: function reply(destination, message, tts) {
var callback = arguments.length <= 3 || arguments[3] === undefined ? function (err, msg) {} : arguments[3];

@@ -337,2 +337,8 @@ var self = this;

if (typeof tts === "function") {
// tts is a function, which means the developer wants this to be the callback
callback = tts;
tts = false;
}
var user = destination.sender;

@@ -646,5 +652,5 @@ self.sendMessage(destination, message, callback, user + ", ").then(response)["catch"](reject);

key: "sendMessage",
value: function sendMessage(destination, message) {
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (err, msg) {} : arguments[2];
var premessage = arguments.length <= 3 || arguments[3] === undefined ? "" : arguments[3];
value: function sendMessage(destination, message, tts) {
var callback = arguments.length <= 3 || arguments[3] === undefined ? function (err, msg) {} : arguments[3];
var premessage = arguments.length <= 4 || arguments[4] === undefined ? "" : arguments[4];

@@ -655,2 +661,8 @@ var self = this;

if (typeof tts === "function") {
// tts is a function, which means the developer wants this to be the callback
callback = tts;
tts = false;
}
message = premessage + resolveMessage(message);

@@ -676,2 +688,3 @@ var mentions = resolveMentions();

mentions: mentions,
tts: !!tts, //incase it's not a boolean
then: mgood,

@@ -683,3 +696,3 @@ error: mbad

} else {
self._sendMessage(destination, message, mentions).then(mgood)["catch"](mbad);
self._sendMessage(destination, message, tts, mentions).then(mgood)["catch"](mbad);
}

@@ -1405,3 +1418,3 @@ }

key: "_sendMessage",
value: function _sendMessage(destination, content, mentions) {
value: function _sendMessage(destination, content, tts, mentions) {

@@ -1413,3 +1426,4 @@ var self = this;

content: content,
mentions: mentions
mentions: mentions,
tts: tts
}).end(function (err, res) {

@@ -1534,3 +1548,3 @@

var msgToSend = queuedEvent;
self._sendMessage(channelID, msgToSend.content, msgToSend.mentions).then(function (msg) {
self._sendMessage(channelID, msgToSend.content, msgToSend.tts, msgToSend.mentions).then(function (msg) {
msgToSend.then(msg);

@@ -1537,0 +1551,0 @@ self.queue[channelID].shift();

{
"name": "discord.js",
"version": "3.2.1",
"version": "3.3.0",
"description": "A way to interface with the Discord API",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -32,3 +32,3 @@ //discord.js modules

this.websocket = null;
this.events = new Map();
this.events = {};
this.user = null;

@@ -107,7 +107,7 @@ this.alreadySentData = false;

on(event, fn) {
this.events.set(event, fn);
this.events[event] = fn;
}
off(event, fn) {
this.events.delete(event);
off(event) {
this.events[event] = null;
}

@@ -129,3 +129,3 @@

}
var evt = this.events.get(event);
var evt = this.events[event];
if (evt) {

@@ -367,3 +367,3 @@ evt.apply(this, args.slice(1));

reply(destination, message, callback = function (err, msg) { }) {
reply(destination, message, tts, callback = function (err, msg) { }) {

@@ -374,2 +374,8 @@ var self = this;

if(typeof tts === "function"){
// tts is a function, which means the developer wants this to be the callback
callback = tts;
tts = false;
}
var user = destination.sender;

@@ -652,3 +658,3 @@ self.sendMessage(destination, message, callback, user + ", ").then(response).catch(reject);

sendMessage(destination, message, callback = function (err, msg) { }, premessage = "") {
sendMessage(destination, message, tts, callback = function (err, msg) { }, premessage = "") {

@@ -658,3 +664,9 @@ var self = this;

var prom = new Promise(function (resolve, reject) {
if(typeof tts === "function"){
// tts is a function, which means the developer wants this to be the callback
callback = tts;
tts = false;
}
message = premessage + resolveMessage(message);

@@ -680,2 +692,3 @@ var mentions = resolveMentions();

mentions: mentions,
tts : !!tts, //incase it's not a boolean
then: mgood,

@@ -687,3 +700,3 @@ error: mbad

} else {
self._sendMessage(destination, message, mentions).then(mgood).catch(mbad);
self._sendMessage(destination, message, tts, mentions).then(mgood).catch(mbad);
}

@@ -1165,3 +1178,3 @@

_sendMessage(destination, content, mentions) {
_sendMessage(destination, content, tts, mentions) {

@@ -1176,3 +1189,4 @@ var self = this;

content: content,
mentions: mentions
mentions: mentions,
tts : tts
})

@@ -1291,3 +1305,3 @@ .end(function (err, res) {

var msgToSend = queuedEvent;
self._sendMessage(channelID, msgToSend.content, msgToSend.mentions)
self._sendMessage(channelID, msgToSend.content, msgToSend.tts, msgToSend.mentions)
.then(function (msg) {

@@ -1294,0 +1308,0 @@ msgToSend.then(msg);

@@ -19,3 +19,3 @@ var Discord = require("../");

var action1 = mybot.sendMessage(message.channel, "this is message " + 1);
var action1 = mybot.sendMessage(message.channel, "this is message " + 1, true);
var action2 = mybot.sendMessage(message.channel, "this is message " + 2).then(log);

@@ -33,5 +33,2 @@

console.log("im ready");
setInterval(function(){
console.log(mybot.websocket.state, "state");
}, 2000);
})

@@ -38,0 +35,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc