Socket
Socket
Sign inDemoInstall

discord-slim

Package Overview
Dependencies
4
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-dev.4 to 2.0.0-dev.5

27

dist/client.d.ts

@@ -6,3 +6,3 @@ /// <reference types="node" />

import { EventHandler, GenericEvents } from './eventhandler';
import type { User } from './types';
import type { User, Activity } from './types';
export declare class Client extends EventEmitter {

@@ -21,2 +21,3 @@ private _sessionId?;

private _wsDisconnect;
private _send;
private _onMessage;

@@ -30,6 +31,24 @@ private _identify;

Disconnect: (code?: number | undefined) => void;
WsSend: (packet: {
op: helpers.OPCodes | number;
d: any;
RequestGuildMembers: (params: {
guild_id: string;
presences?: boolean;
nonce?: string;
} & ({
query: string;
limit: number;
} | {
user_ids: string | string[];
})) => void;
UpdateVoiceState: (params: {
guild_id: string;
channel_id: string | null;
self_mute: boolean;
self_deaf: boolean;
}) => void;
UpdateStatus: (params: {
since: number | null;
activities: Activity[] | null;
status: 'online' | 'dnd' | 'idle' | 'invisible' | 'offline';
afk: boolean;
}) => void;
get events(): EventHandler<GenericEvents>;

@@ -36,0 +55,0 @@ get user(): User | undefined;

47

dist/client.js

@@ -62,2 +62,3 @@ "use strict";

};
this._send = (op, d) => this._ws && this._ws.send(JSON.stringify({ op, d }));
this._onMessage = (data) => {

@@ -109,19 +110,13 @@ if (typeof data != 'string')

var _a, _b, _c;
this._ws && this._ws.send(JSON.stringify(this._sessionId ?
{
op: 6,
d: {
token: (_a = this._auth) === null || _a === void 0 ? void 0 : _a.authorization.token,
session_id: this._sessionId,
seq: this._lastSequence,
},
} :
{
op: 2,
d: {
token: (_b = this._auth) === null || _b === void 0 ? void 0 : _b.authorization.token,
properties: { $os: 'linux', $browser: 'bot', $device: 'bot' },
intents: (_c = this._intents) !== null && _c !== void 0 ? _c : helpers.Intents.SYSTEM_ONLY,
},
}));
this._sessionId ?
this._send(6, {
token: (_a = this._auth) === null || _a === void 0 ? void 0 : _a.authorization.token,
session_id: this._sessionId,
seq: this._lastSequence,
}) :
this._send(2, {
token: (_b = this._auth) === null || _b === void 0 ? void 0 : _b.authorization.token,
properties: { $os: 'linux', $browser: 'bot', $device: 'bot' },
intents: (_c = this._intents) !== null && _c !== void 0 ? _c : helpers.Intents.SYSTEM_ONLY,
});
};

@@ -132,3 +127,3 @@ this._sendHeartbeat = () => {

this._lastHeartbeatAck = false;
this._ws.send(JSON.stringify({ op: 1, d: this._lastSequence }));
this._send(1, this._lastSequence);
}

@@ -165,7 +160,17 @@ }

};
this.WsSend = (packet) => {
this.RequestGuildMembers = (params) => {
if (!this._ws)
throw 'Unable to send packet: no connection.';
this._ws.send((packet && (typeof packet == 'object')) ? JSON.stringify(packet) : packet);
throw 'No connection.';
this._send(8, params);
};
this.UpdateVoiceState = (params) => {
if (!this._ws)
throw 'No connection.';
this._send(4, params);
};
this.UpdateStatus = (params) => {
if (!this._ws)
throw 'No connection.';
this._send(3, params);
};
}

@@ -172,0 +177,0 @@ get events() { return this._eventHandler; }

{
"name": "discord-slim",
"version": "2.0.0-dev.4",
"version": "2.0.0-dev.5",
"description": "Lightweight Discord client for Node.js.",

@@ -5,0 +5,0 @@ "author": "Hanabishi",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc