discord-slim
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -18,2 +18,3 @@ /// <reference types="node" /> | ||
private _shard?; | ||
private _props?; | ||
constructor(); | ||
@@ -62,2 +63,4 @@ private _wsConnect; | ||
get user(): User | undefined; | ||
get props(): object | null | undefined; | ||
set props(value: object | null | undefined); | ||
} | ||
@@ -64,0 +67,0 @@ export declare enum ClientEvents { |
@@ -19,2 +19,3 @@ "use strict"; | ||
this._eventHandler = new events_1.EventEmitter(); | ||
this._props = { $os: 'linux', $browser: 'bot', $device: 'bot' }; | ||
this._wsConnect = async (resume) => { | ||
@@ -27,3 +28,5 @@ this._wsDisconnect(); | ||
} | ||
const response = await request_1.Request('GET', '/gateway/bot', this._auth).catch(() => { }); | ||
const response = await request_1.Request('GET', this._auth?.authorization.type == request_1.TokenTypes.BOT ? | ||
'/gateway/bot' : | ||
'/gateway', this._auth).catch(() => { }); | ||
if (this._ws) | ||
@@ -101,3 +104,3 @@ return this.emit(ClientEvents.WARN, 'Client already connected.'); | ||
token: this._auth?.authorization.token, | ||
properties: { $os: 'linux', $browser: 'bot', $device: 'bot' }, | ||
properties: this._props, | ||
intents: this._intents ?? helpers_1.Intents.SYSTEM, | ||
@@ -158,2 +161,4 @@ shard: this._shard, | ||
get user() { return this._user; } | ||
get props() { return this._props; } | ||
set props(value) { this._props = value; } | ||
} | ||
@@ -160,0 +165,0 @@ exports.Client = Client; |
export declare enum TokenTypes { | ||
BOT = "Bot", | ||
BEARER = "Bearer" | ||
BEARER = "Bearer", | ||
NONE = "" | ||
} | ||
@@ -5,0 +6,0 @@ export declare class Authorization { |
@@ -15,6 +15,9 @@ "use strict"; | ||
TokenTypes["BEARER"] = "Bearer"; | ||
TokenTypes["NONE"] = ""; | ||
})(TokenTypes = exports.TokenTypes || (exports.TokenTypes = {})); | ||
class Authorization { | ||
constructor(token, type = TokenTypes.BOT) { | ||
this._update = () => this._cache = `${this._type} ${this._token}`; | ||
this._update = () => this._cache = this._type ? | ||
`${this._type} ${this._token}` : | ||
this._token; | ||
this.toString = () => this._cache; | ||
@@ -21,0 +24,0 @@ this._token = token; |
{ | ||
"name": "discord-slim", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Lightweight Discord bot API for Node.js.", | ||
@@ -5,0 +5,0 @@ "author": "Hanabishi", |
@@ -15,2 +15,3 @@ # Discord Slim | ||
- Voice connection. | ||
- Ability to auth as user (at your own risk!). | ||
@@ -17,0 +18,0 @@ ### Support & suggestions |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143157
2947
140