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

discord-slim

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-slim - npm Package Compare versions

Comparing version 2.0.0-dev.8 to 2.0.0-dev.9

48

dist/client.d.ts

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

import { Authorization } from './request';
import { EventHandler, EventTypes } from './events';
import { EventHandler } from './events';
import type { User } from './types';

@@ -60,3 +60,3 @@ export declare class Client extends EventEmitter {

}) => void;
get events(): EventHandler<EventTypes>;
get events(): EventHandler;
get user(): User | undefined;

@@ -72,6 +72,6 @@ }

}
export interface Client {
on(event: ClientEvents.CONNECT, listener: (this: this) => void): this;
on(event: ClientEvents.DISCONNECT, listener: (this: this, code: number) => void): this;
on(event: ClientEvents.INTENT, listener: (this: this, intent: {
declare type ClientEventTypes = {
[ClientEvents.CONNECT]: void;
[ClientEvents.DISCONNECT]: number;
[ClientEvents.INTENT]: {
op: 0;

@@ -81,28 +81,12 @@ s: number;

d: any;
}) => void): this;
on(event: ClientEvents.WARN, listener: (this: this, message: string) => void): this;
on(event: ClientEvents.ERROR, listener: (this: this, error: Error) => void): this;
on(event: ClientEvents.FATAL, listener: (this: this, message: string) => void): this;
off(event: ClientEvents.CONNECT, listener: (this: this) => void): this;
off(event: ClientEvents.DISCONNECT, listener: (this: this, code: number) => void): this;
off(event: ClientEvents.INTENT, listener: (this: this, intent: {
op: 0;
s: number;
t: string;
d: any;
}) => void): this;
off(event: ClientEvents.WARN, listener: (this: this, message: string) => void): this;
off(event: ClientEvents.ERROR, listener: (this: this, error: Error) => void): this;
off(event: ClientEvents.FATAL, listener: (this: this, message: string) => void): this;
once(event: ClientEvents.CONNECT, listener: (this: this) => void): this;
once(event: ClientEvents.DISCONNECT, listener: (this: this, code: number) => void): this;
once(event: ClientEvents.INTENT, listener: (this: this, intent: {
op: 0;
s: number;
t: string;
d: any;
}) => void): this;
once(event: ClientEvents.WARN, listener: (this: this, message: string) => void): this;
once(event: ClientEvents.ERROR, listener: (this: this, error: Error) => void): this;
once(event: ClientEvents.FATAL, listener: (this: this, message: string) => void): this;
};
[ClientEvents.WARN]: string;
[ClientEvents.ERROR]: Error;
[ClientEvents.FATAL]: string;
};
export interface Client extends EventEmitter {
on<K extends ClientEvents>(event: K, callback: (data: ClientEventTypes[K]) => void): this;
once<K extends ClientEvents>(event: K, callback: (data: ClientEventTypes[K]) => void): this;
off<K extends ClientEvents>(event: K, callback: (data: ClientEventTypes[K]) => void): this;
}
export {};

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

const request_1 = require("./request");
const events_2 = require("./events");
class Client extends events_1.EventEmitter {

@@ -38,3 +37,3 @@ constructor() {

this._lastHeartbeatAck = false;
this._eventHandler = new events_2.EventHandler();
this._eventHandler = new events_1.EventEmitter();
this._wsConnect = async (resume) => {

@@ -41,0 +40,0 @@ this._wsDisconnect();

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

}
export declare type EventTypes = {
declare type EventTypes = {
[Events.READY]: {

@@ -61,3 +61,3 @@ v: number;

};
[Events.RESUMED]: null;
[Events.RESUMED]: {};
[Events.APPLICATION_COMMAND_CREATE]: types.ApplicationCommand & {

@@ -212,12 +212,7 @@ guild_id?: string;

};
declare type EventMap = Record<string, any>;
declare type EventKey<T extends EventMap> = string & keyof T;
declare type EventReceiver<T> = (params: T) => void;
export declare class EventHandler<T extends EventMap> {
private _em;
on: <K extends EventKey<T>>(event: K, callback: EventReceiver<T[K]>) => EventEmitter;
once: <K extends EventKey<T>>(event: K, callback: EventReceiver<T[K]>) => EventEmitter;
off: <K extends EventKey<T>>(event: K, callback: EventReceiver<T[K]>) => EventEmitter;
emit: <K extends EventKey<T>>(event: string | K, params: any) => boolean;
export interface EventHandler extends EventEmitter {
on<K extends Events>(event: K, callback: (data: EventTypes[K]) => void): this;
once<K extends Events>(event: K, callback: (data: EventTypes[K]) => void): this;
off<K extends Events>(event: K, callback: (data: EventTypes[K]) => void): this;
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventHandler = exports.Events = void 0;
const events_1 = require("events");
exports.Events = void 0;
var Events;

@@ -48,11 +47,1 @@ (function (Events) {

})(Events = exports.Events || (exports.Events = {}));
class EventHandler {
constructor() {
this._em = new events_1.EventEmitter();
this.on = (event, callback) => this._em.on(event, callback);
this.once = (event, callback) => this._em.once(event, callback);
this.off = (event, callback) => this._em.off(event, callback);
this.emit = (event, params) => this._em.emit(event, params);
}
}
exports.EventHandler = EventHandler;
{
"name": "discord-slim",
"version": "2.0.0-dev.8",
"version": "2.0.0-dev.9",
"description": "Lightweight Discord bot API for Node.js.",

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

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