Socket
Socket
Sign inDemoInstall

discord.js

Package Overview
Dependencies
Maintainers
1
Versions
1703
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.4.0 to 3.4.1

90

lib/Client.js

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

this.serverCreateListener = {};
this.typingIntervals = {};
this.email = "abc";

@@ -1152,2 +1152,8 @@ this.password = "abc";

if (data.unavailable) {
self.trigger("unavailable", data);
self.debug("Server ID" + +" has been marked unavailable by Discord. It was not cached.");
return;
}
if (!server) {

@@ -1359,3 +1365,3 @@ server = new Server(data, this);

token: this.token,
v: 2,
v: 3,
properties: {

@@ -1648,2 +1654,82 @@ "$os": "discord.js",

}, {
key: "setStatusIdle",
value: function setStatusIdle() {
this.setStatus("idle");
}
}, {
key: "setStatusOnline",
value: function setStatusOnline() {
this.setStatus("online");
}
}, {
key: "setStatusActive",
value: function setStatusActive() {
this.setStatusOnline();
}
}, {
key: "setStatusHere",
value: function setStatusHere() {
this.setStatusOnline();
}
}, {
key: "setStatusAway",
value: function setStatusAway() {
this.setStatusIdle();
}
}, {
key: "startTyping",
value: function startTyping(chann) {
var self = this;
this.resolveDestination(chann).then(next);
function next(channel) {
if (self.typingIntervals[channel]) {
return;
}
var fn = function fn() {
console.log(Endpoints.CHANNELS + "/" + channel + "/typing");
request.post(Endpoints.CHANNELS + "/" + channel + "/typing").set("authorization", self.token).end();
};
fn();
var interval = setInterval(fn, 3000);
self.typingIntervals[channel] = interval;
}
}
}, {
key: "stopTyping",
value: function stopTyping(chann) {
var self = this;
this.resolveDestination(chann).then(next);
function next(channel) {
if (!self.typingIntervals[channel]) {
return;
}
clearInterval(self.typingIntervals[channel]);
delete self.typingIntervals[channel];
}
}
}, {
key: "setStatus",
value: function setStatus(stat) {
var idleTime = stat === "online" ? null : Date.now();
this.websocket.send(JSON.stringify({
op: 3,
d: {
idle_since: idleTime,
game_id: null
}
}));
}
}, {
key: "uptime",

@@ -1650,0 +1736,0 @@ get: function get() {

2

package.json
{
"name": "discord.js",
"version": "3.4.0",
"version": "3.4.1",
"description": "A way to interface with the Discord API",

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

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

this.serverCreateListener = {};
this.typingIntervals = {};
this.email = "abc";

@@ -1052,2 +1052,8 @@ this.password = "abc";

if(data.unavailable){
self.trigger("unavailable", data);
self.debug("Server ID" + + " has been marked unavailable by Discord. It was not cached.");
return;
}
if (!server) {

@@ -1120,3 +1126,3 @@ server = new Server(data, this);

token: this.token,
v: 2,
v: 3,
properties: {

@@ -1388,4 +1394,80 @@ "$os": "discord.js",

}
setStatusIdle(){
this.setStatus("idle");
}
setStatusOnline(){
this.setStatus("online");
}
setStatusActive(){
this.setStatusOnline();
}
setStatusHere(){
this.setStatusOnline();
}
setStatusAway(){
this.setStatusIdle();
}
startTyping(chann){
var self = this;
this.resolveDestination(chann).then(next);
function next(channel){
if(self.typingIntervals[channel]){
return;
}
var fn = function(){
console.log(`${Endpoints.CHANNELS}/${channel}/typing`);
request
.post(`${Endpoints.CHANNELS}/${channel}/typing`)
.set("authorization", self.token)
.end();
};
fn();
var interval = setInterval(fn, 3000);
self.typingIntervals[channel] = interval;
}
}
stopTyping(chann){
var self = this;
this.resolveDestination(chann).then(next);
function next(channel){
if(!self.typingIntervals[channel]){
return;
}
clearInterval(self.typingIntervals[channel]);
delete self.typingIntervals[channel];
}
}
setStatus(stat){
var idleTime = (stat === "online" ? null : Date.now());
this.websocket.send(JSON.stringify({
op : 3,
d : {
idle_since : idleTime,
game_id : null
}
}));
}
}
module.exports = Client;

@@ -21,8 +21,10 @@ var Discord = require("../");

var onlineUsers = 0;
for(user of message.channel.users){
if(user.status === "online" || user.status === "idle")
onlineUsers++;
}
mybot.reply(message, onlineUsers);
mybot.startTyping(message.channel);
setTimeout(function(){
mybot.reply(message, "stopping now k");
mybot.stopTyping(message.channel);
}, 6000);
});

@@ -32,4 +34,12 @@

console.log("im ready");
});
mybot.on("debug", function(info){
console.log(info);
})
mybot.on("unavailable", function(info){
console.log("warning!", info);
})
function dump(msg) {

@@ -36,0 +46,0 @@ console.log(msg);

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