cloudstorm
Advanced tools
Comparing version 0.3.2 to 0.4.0
@@ -44,3 +44,3 @@ /// <reference types="node" /> | ||
shardManager: ShardManager; | ||
version: any; | ||
version: string; | ||
private _restClient; | ||
@@ -67,3 +67,7 @@ static readonly default: typeof Client; | ||
*/ | ||
getGatewayBot(): Promise<any>; | ||
getGatewayBot(): Promise<{ | ||
url: string; | ||
shards: number; | ||
session_start_limit: import("discord-typings").SessionStartLimit; | ||
}>; | ||
/** | ||
@@ -89,3 +93,3 @@ * Disconnect the bot gracefully, | ||
*/ | ||
presenceUpdate(data: import("./Types").IPresence): Promise<void>; | ||
presenceUpdate(data: import("discord-typings").GatewayPresenceUpdate): Promise<void>; | ||
/** | ||
@@ -108,3 +112,3 @@ * Send an OP 3 PRESENCE_UPDATE to Discord, which updates the status of a single shard facilitated by this client's ShardManager. | ||
*/ | ||
shardStatusUpdate(shardId: number, data: import("./Types").IPresence): Promise<void>; | ||
shardStatusUpdate(shardId: number, data: import("discord-typings").GatewayPresenceUpdate): Promise<void>; | ||
/** | ||
@@ -129,3 +133,6 @@ * Send an OP 4 VOICE_STATE_UPDATE to Discord. this does **not** allow you to send audio with CloudStorm itself, | ||
*/ | ||
voiceStateUpdate(shardId: number, data: import("./Types").IVoiceStateUpdate): Promise<void>; | ||
voiceStateUpdate(shardId: number, data: import("discord-typings").VoiceStateUpdatePayload & { | ||
self_deaf?: boolean; | ||
self_mute?: boolean; | ||
}): Promise<void>; | ||
/** | ||
@@ -149,3 +156,5 @@ * Send an OP 8 REQUEST_GUILD_MEMBERS to Discord. | ||
*/ | ||
requestGuildMembers(shardId: number, data: import("./Types").IRequestGuildMembers): Promise<void>; | ||
requestGuildMembers(shardId: number, data: import("discord-typings").GuildRequestMembersPayload & { | ||
limit?: number; | ||
}): Promise<void>; | ||
/** | ||
@@ -152,0 +161,0 @@ * Update the endpoint shard websockets will connect to. |
@@ -56,4 +56,4 @@ "use strict"; | ||
async connect() { | ||
const gatewayUrl = await this.getGateway(); | ||
this._updateEndpoint(gatewayUrl); | ||
const gateway = await this.getGateway(); | ||
this._updateEndpoint(gateway); | ||
this.shardManager.spawn(); | ||
@@ -60,0 +60,0 @@ } |
@@ -107,3 +107,3 @@ /// <reference types="node" /> | ||
*/ | ||
presenceUpdate(data?: import("../Types").IPresence): Promise<void>; | ||
presenceUpdate(data: import("discord-typings").GatewayPresenceUpdate): Promise<void>; | ||
/** | ||
@@ -113,3 +113,6 @@ * Send an OP 4 VOICE_STATE_UPDATE to the gateway. | ||
*/ | ||
voiceStateUpdate(data: import("../Types").IVoiceStateUpdate): Promise<void>; | ||
voiceStateUpdate(data: import("discord-typings").VoiceStateUpdatePayload & { | ||
self_deaf?: boolean; | ||
self_mute?: boolean; | ||
}): Promise<void>; | ||
/** | ||
@@ -119,3 +122,5 @@ * Send an OP 8 REQUEST_GUILD_MEMBERS to the gateway. | ||
*/ | ||
requestGuildMembers(data: import("../Types").IRequestGuildMembers): Promise<void>; | ||
requestGuildMembers(data: import("discord-typings").GuildRequestMembersPayload & { | ||
limit?: number; | ||
}): Promise<void>; | ||
/** | ||
@@ -122,0 +127,0 @@ * Checks presence data and fills in missing elements. |
@@ -347,3 +347,3 @@ "use strict"; | ||
*/ | ||
async presenceUpdate(data = {}) { | ||
async presenceUpdate(data) { | ||
var _a; | ||
@@ -378,3 +378,3 @@ return (_a = this.betterWs) === null || _a === void 0 ? void 0 : _a.sendMessage({ op: Constants_1.GATEWAY_OP_CODES.PRESENCE_UPDATE, d: this._checkPresenceData(data) }); | ||
data.status = data.status || "online"; | ||
data.activities = data.activities && Array.isArray(data.activities) ? data.activities : null; | ||
data.activities = data.activities && Array.isArray(data.activities) ? data.activities : []; | ||
if (data.activities) { | ||
@@ -390,3 +390,3 @@ for (const activity of data.activities) { | ||
data.afk = data.afk || false; | ||
data.since = data.since || false; | ||
data.since = data.since || Date.now(); | ||
return data; | ||
@@ -393,0 +393,0 @@ } |
@@ -47,4 +47,4 @@ export declare const GATEWAY_OP_CODES: { | ||
}; | ||
export declare const GATEWAY_VERSION = 9; | ||
export declare const GATEWAY_VERSION = 10; | ||
declare const _default: typeof import("./Constants"); | ||
export default _default; |
@@ -50,3 +50,3 @@ "use strict"; | ||
}; | ||
exports.GATEWAY_VERSION = 9; | ||
exports.GATEWAY_VERSION = 10; | ||
exports.default = exports; |
@@ -58,3 +58,3 @@ /// <reference types="node" /> | ||
*/ | ||
presenceUpdate(data: import("./Types").IPresence): Promise<void>; | ||
presenceUpdate(data: import("discord-typings").GatewayPresenceUpdate): Promise<void>; | ||
/** | ||
@@ -64,3 +64,6 @@ * Send an OP 4 VOICE_STATE_UPDATE to Discord. | ||
*/ | ||
voiceStateUpdate(data: import("./Types").IVoiceStateUpdate): Promise<void>; | ||
voiceStateUpdate(data: import("discord-typings").VoiceStateUpdatePayload & { | ||
self_deaf?: boolean; | ||
self_mute?: boolean; | ||
}): Promise<void>; | ||
/** | ||
@@ -70,4 +73,6 @@ * Send an OP 8 REQUEST_GUILD_MEMBERS to Discord. | ||
*/ | ||
requestGuildMembers(data: import("./Types").IRequestGuildMembers): Promise<void>; | ||
requestGuildMembers(data: import("discord-typings").GuildRequestMembersPayload & { | ||
limit?: number; | ||
}): Promise<void>; | ||
} | ||
export = Shard; |
@@ -59,3 +59,3 @@ /// <reference types="node" /> | ||
*/ | ||
presenceUpdate(data?: import("./Types").IPresence): Promise<void>; | ||
presenceUpdate(data: import("discord-typings").GatewayPresenceUpdate): Promise<void>; | ||
/** | ||
@@ -66,3 +66,3 @@ * Update the status of a single connected shard which has been spawned by this manager. | ||
*/ | ||
shardPresenceUpdate(shardId: number, data?: import("./Types").IPresence): Promise<void>; | ||
shardPresenceUpdate(shardId: number, data: import("discord-typings").GatewayPresenceUpdate): Promise<void>; | ||
/** | ||
@@ -73,3 +73,6 @@ * Send an OP 4 VOICE_STATE_UPDATE with a certain shard. | ||
*/ | ||
voiceStateUpdate(shardId: number, data: import("./Types").IVoiceStateUpdate): Promise<void>; | ||
voiceStateUpdate(shardId: number, data: import("discord-typings").VoiceStateUpdatePayload & { | ||
self_deaf?: boolean; | ||
self_mute?: boolean; | ||
}): Promise<void>; | ||
/** | ||
@@ -80,4 +83,6 @@ * Send an OP 8 REQUEST_GUILD_MEMBERS with a certain shard. | ||
*/ | ||
requestGuildMembers(shardId: number, data: import("./Types").IRequestGuildMembers): Promise<void>; | ||
requestGuildMembers(shardId: number, data: import("discord-typings").GuildRequestMembersPayload & { | ||
limit?: number; | ||
}): Promise<void>; | ||
} | ||
export = ShardManager; |
@@ -144,3 +144,3 @@ "use strict"; | ||
*/ | ||
async presenceUpdate(data = {}) { | ||
async presenceUpdate(data) { | ||
for (const shardKey in this.shards) { | ||
@@ -158,3 +158,3 @@ if (this.shards[shardKey]) { | ||
*/ | ||
shardPresenceUpdate(shardId, data = {}) { | ||
shardPresenceUpdate(shardId, data) { | ||
return new Promise((res, rej) => { | ||
@@ -161,0 +161,0 @@ const shard = this.shards[shardId]; |
@@ -1,2 +0,2 @@ | ||
Copyright 2021 DasWolke | ||
Copyright 2022 DasWolke | ||
@@ -3,0 +3,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
{ | ||
"name": "cloudstorm", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "Minimalistic Discord Gateway library", | ||
@@ -17,4 +17,4 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"snowtransfer": "^0.3.x", | ||
"ws": "^8.3.0", | ||
"snowtransfer": "^0.4.x", | ||
"ws": "^8.5.0", | ||
"zlib-sync": "^0.1.7" | ||
@@ -24,10 +24,10 @@ }, | ||
"@types/node": "16.7.1", | ||
"@types/ws": "^8.2.1", | ||
"@typescript-eslint/eslint-plugin": "^5.5.0", | ||
"@typescript-eslint/parser": "^5.5.0", | ||
"eslint": "^8.3.0", | ||
"typedoc": "^0.22.10", | ||
"typedoc-plugin-mdn-links": "^1.0.4", | ||
"@types/ws": "^8.2.3", | ||
"@typescript-eslint/eslint-plugin": "^5.12.0", | ||
"@typescript-eslint/parser": "^5.12.0", | ||
"eslint": "^8.9.0", | ||
"typedoc": "^0.22.12", | ||
"typedoc-plugin-mdn-links": "^1.0.5", | ||
"typedoc-plugin-missing-exports": "^0.22.6", | ||
"typescript": "^4.5.2" | ||
"typescript": "^4.5.5" | ||
}, | ||
@@ -34,0 +34,0 @@ "optionalDependencies": { |
@@ -59,4 +59,4 @@ # A minimal discord gateway library | ||
### Installation: | ||
To install CloudStorm, make sure that you have node 8 or higher and npm installed on your computer. | ||
To install CloudStorm, make sure that you have node 12 or higher and npm installed on your computer. | ||
Then run the following command in a terminal `npm install cloudstorm` |
Sorry, the diff of this file is not supported yet
106207
2042
+ Addeddiscord-typings@10.4.1(transitive)
+ Addedsnowtransfer@0.4.3(transitive)
- Removeddiscord-typings@9.0.7(transitive)
- Removedsnowtransfer@0.3.6(transitive)
Updatedsnowtransfer@^0.4.x
Updatedws@^8.5.0