disgroove 3.0.0-dev.72bf12 → 3.0.0-dev.97f3796

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,7 +55,7 @@ export declare class Client extends EventEmitter {
55
55
  auth: "Bot" | "Bearer";
56
56
  shards: Map<number, Shard>;
57
57
  rest: RequestManager;
58
- guildShardMap: Record<string, number>;
58
+ guildShardMap: Map<string, number>;
59
59
  user: User | null;
60
60
  guilds: Map<string, Guild>;
61
61
  application: Pick<Application, "id" | "flags"> | null;
@@ -42,7 +42,7 @@ class Client extends node_events_1.default {
42
42
  this.auth = options?.auth ?? "Bot";
43
43
  this.shards = new Map();
44
44
  this.rest = new rest_1.RequestManager(token, this.auth);
45
- this.guildShardMap = {};
45
+ this.guildShardMap = new Map();
46
46
  this.user = null;
47
47
  this.guilds = new Map();
48
48
  this.application = null;
@@ -2361,7 +2361,7 @@ class Client extends node_events_1.default {
2361
2361
  }
2362
2362
  /** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
2363
2363
  joinVoiceChannel(guildId, channelId, options) {
2364
- this.shards.get(this.guildShardMap[guildId]).updateVoiceState({
2364
+ this.shards.get(this.guildShardMap.get(guildId)).updateVoiceState({
2365
2365
  guildId,
2366
2366
  channelId,
2367
2367
  selfMute: !!options?.selfMute,
@@ -2382,7 +2382,7 @@ class Client extends node_events_1.default {
2382
2382
  }
2383
2383
  /** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
2384
2384
  leaveVoiceChannel(guildId) {
2385
- this.shards.get(this.guildShardMap[guildId]).updateVoiceState({
2385
+ this.shards.get(this.guildShardMap.get(guildId)).updateVoiceState({
2386
2386
  guildId,
2387
2387
  channelId: null,
2388
2388
  selfMute: false,
@@ -241,7 +241,7 @@ class Shard {
241
241
  break;
242
242
  case constants_1.GatewayEvents.GuildCreate:
243
243
  {
244
- this.client.guildShardMap[packet.d.id] = this.id;
244
+ this.client.guildShardMap.set(packet.d.id, this.id);
245
245
  this.client.guilds.set(packet.d.id, transformers_1.Guilds.guildFromRaw(packet.d));
246
246
  this.client.emit("guildCreate", transformers_1.Guilds.guildFromRaw(packet.d));
247
247
  }
@@ -254,7 +254,7 @@ class Shard {
254
254
  break;
255
255
  case constants_1.GatewayEvents.GuildDelete:
256
256
  {
257
- delete this.client.guildShardMap[packet.d.id];
257
+ this.client.guildShardMap.delete(packet.d.id);
258
258
  this.client.guilds.delete(packet.d.id);
259
259
  this.client.emit("guildDelete", {
260
260
  id: packet.d.id,
@@ -1,3 +1,4 @@
1
1
  export * as CDN from "./CDN";
2
2
  export * from "./errors";
3
3
  export * from "./formatters";
4
+ export * from "./permissions";
@@ -40,3 +40,4 @@ exports.CDN = void 0;
40
40
  exports.CDN = __importStar(require("./CDN"));
41
41
  __exportStar(require("./errors"), exports);
42
42
  __exportStar(require("./formatters"), exports);
43
+ __exportStar(require("./permissions"), exports);
@@ -0,0 +1,2 @@
1
+ /** https://discord.com/developers/docs/topics/permissions */
2
+ export declare function hasPermission(userPermissions: string, permission: bigint): boolean;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasPermission = hasPermission;
4
+ /** https://discord.com/developers/docs/topics/permissions */
5
+ function hasPermission(userPermissions, permission) {
6
+ return (BigInt(userPermissions) & permission) === permission;
7
+ }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "3.0.0-dev.72bf12",
3
+ "version": "2.2.7",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "3.0.0-dev.72bf12",
3
+ "version": "3.0.0-dev.97f3796",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
@@ -33,4 +33,4 @@
33
33
  "dependencies": {
34
34
  "ws": "^8.18.3"
35
35
  }
36
- }
36
+ }