disgroove 2.2.3-dev.4f98e3d → 2.2.3-dev.f471c4a

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.
@@ -2,7 +2,7 @@
2
2
  import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, type MFALevel, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags, type InteractionContextTypes } from "./constants";
3
3
  import { RequestManager, type File } from "./rest";
4
4
  import EventEmitter from "node:events";
5
- import { ShardManager } from "./gateway";
5
+ import { Shard } from "./gateway";
6
6
  import type { Application, ApplicationIntegrationTypeConfiguration, InstallParams } from "./types/application";
7
7
  import type { ApplicationCommand, GuildApplicationCommandPermissions, ApplicationCommandOption, ApplicationCommandPermission } from "./types/application-command";
8
8
  import type { ApplicationRoleConnectionMetadata } from "./types/application-role-connection-metadata";
@@ -50,7 +50,7 @@ export declare class Client extends EventEmitter {
50
50
  intents: GatewayIntents | number;
51
51
  shardsCount: number | "auto";
52
52
  auth: "Bot" | "Bearer";
53
- shards: ShardManager;
53
+ shards: Map<number, Shard>;
54
54
  rest: RequestManager;
55
55
  guildShardMap: Record<string, number>;
56
56
  user: User | null;
@@ -799,7 +799,7 @@ export declare class Client extends EventEmitter {
799
799
  after?: snowflake;
800
800
  limit?: number;
801
801
  withCounts?: boolean;
802
- }): Promise<Array<Pick<Guild, "id" | "name" | "icon" | "owner" | "permissions" | "features" | "approximateMemberCount" | "approximatePresenceCount">>>;
802
+ }): Promise<Array<Pick<Guild, "id" | "name" | "icon" | "banner" | "owner" | "permissions" | "features" | "approximateMemberCount" | "approximatePresenceCount">>>;
803
803
  /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
804
804
  getGuildApplicationCommand(applicationID: snowflake, guildID: snowflake, commandID: snowflake): Promise<ApplicationCommand>;
805
805
  /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
@@ -1023,9 +1023,9 @@ export declare interface Client extends EventEmitter {
1023
1023
  removeListener<K extends keyof ClientEvents>(eventName: K, listener: (...args: ClientEvents[K]) => void): this;
1024
1024
  }
1025
1025
  export interface ClientEvents {
1026
- dispatch: [packet: RawPayload];
1027
- heartbeatACK: [];
1028
- hello: [interval: number];
1026
+ dispatch: [packet: RawPayload, shard: number];
1027
+ heartbeatACK: [shard: number];
1028
+ hello: [interval: number, shard: number];
1029
1029
  ready: [];
1030
1030
  resumed: [];
1031
1031
  reconnect: [];
@@ -40,7 +40,7 @@ class Client extends node_events_1.default {
40
40
  : 0;
41
41
  this.shardsCount = options?.shardsCount ?? "auto";
42
42
  this.auth = options?.auth ?? "Bot";
43
- this.shards = new gateway_1.ShardManager();
43
+ this.shards = new Map();
44
44
  this.rest = new rest_1.RequestManager(token, this.auth);
45
45
  this.guildShardMap = {};
46
46
  this.user = null;
@@ -158,7 +158,7 @@ class Client extends node_events_1.default {
158
158
  : this.shardsCount;
159
159
  for (let i = 0; i < this.shardsCount; i++)
160
160
  this.shards.set(i, new gateway_1.Shard(i, this));
161
- this.shards.connect();
161
+ this.shards.forEach((shard) => shard.connect());
162
162
  }
163
163
  /** https://discord.com/developers/docs/monetization/entitlements#consume-an-entitlement */
164
164
  consumeEntitlement(applicationID, entitlementID) {
@@ -822,7 +822,7 @@ class Client extends node_events_1.default {
822
822
  });
823
823
  }
824
824
  disconnect() {
825
- this.shards.disconnect();
825
+ this.shards.forEach((shard) => shard.disconnect());
826
826
  }
827
827
  /** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
828
828
  async editAutoModerationRule(guildID, autoModerationRuleID, options, reason) {
@@ -1675,6 +1675,7 @@ class Client extends node_events_1.default {
1675
1675
  return response.map((guild) => ({
1676
1676
  id: guild.id,
1677
1677
  name: guild.name,
1678
+ banner: guild.banner,
1678
1679
  icon: guild.icon,
1679
1680
  owner: guild.owner,
1680
1681
  permissions: guild.permissions,
@@ -2118,7 +2119,7 @@ class Client extends node_events_1.default {
2118
2119
  }
2119
2120
  /** https://discord.com/developers/docs/resources/channel#leave-thread */
2120
2121
  leaveThread(channelID) {
2121
- this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID));
2122
+ this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID, "@me"));
2122
2123
  }
2123
2124
  /** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
2124
2125
  leaveVoiceChannel(guildID) {
@@ -2173,7 +2174,7 @@ class Client extends node_events_1.default {
2173
2174
  }
2174
2175
  /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
2175
2176
  setPresence(options) {
2176
- this.shards.updatePresence(options);
2177
+ this.shards.forEach((shard) => shard.updatePresence(options));
2177
2178
  }
2178
2179
  /** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
2179
2180
  async syncGuildTemplate(guildID, code) {
@@ -569,6 +569,7 @@ export declare enum Services {
569
569
  Playstation = "playstation",
570
570
  Reddit = "reddit",
571
571
  RiotGames = "riotgames",
572
+ Roblox = "roblox",
572
573
  Spotify = "spotify",
573
574
  Skype = "skype",
574
575
  Steam = "steam",
@@ -631,6 +631,7 @@ var Services;
631
631
  Services["Playstation"] = "playstation";
632
632
  Services["Reddit"] = "reddit";
633
633
  Services["RiotGames"] = "riotgames";
634
+ Services["Roblox"] = "roblox";
634
635
  Services["Spotify"] = "spotify";
635
636
  Services["Skype"] = "skype";
636
637
  Services["Steam"] = "steam";
@@ -88,7 +88,7 @@ class Shard {
88
88
  }));
89
89
  }
90
90
  onDispatch(packet) {
91
- this.client.emit("dispatch", packet);
91
+ this.client.emit("dispatch", packet, this.id);
92
92
  switch (packet.t) {
93
93
  case constants_1.GatewayEvents.Ready:
94
94
  {
@@ -545,11 +545,11 @@ class Shard {
545
545
  case constants_1.GatewayOPCodes.Hello:
546
546
  {
547
547
  this.heartbeatInterval = setInterval(() => this.heartbeat(null), packet.d.heartbeat_interval);
548
- this.client.emit("hello", packet.d.heartbeat_interval);
548
+ this.client.emit("hello", packet.d.heartbeat_interval, this.id);
549
549
  }
550
550
  break;
551
551
  case constants_1.GatewayOPCodes.HeartbeatACK:
552
- this.client.emit("heartbeatACK");
552
+ this.client.emit("heartbeatACK", this.id);
553
553
  break;
554
554
  }
555
555
  }
@@ -1,2 +1 @@
1
1
  export * from "./Shard";
2
- export * from "./ShardManager";
@@ -15,4 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Shard"), exports);
18
- __exportStar(require("./ShardManager"), exports);
@@ -1,4 +1,4 @@
1
- import type { ActivityFlags, ActivityType, GatewayIntents, GatewayOPCodes, GuildMemberFlags, InviteTargetTypes, ReactionTypes, StatusTypes, TriggerTypes } from "../constants";
1
+ import type { ActivityFlags, ActivityType, GatewayEvents, GatewayIntents, GatewayOPCodes, GuildMemberFlags, InviteTargetTypes, ReactionTypes, StatusTypes, TriggerTypes } from "../constants";
2
2
  import type { RawApplication, Application } from "./application";
3
3
  import type { RawAutoModerationAction, AutoModerationAction } from "./auto-moderation";
4
4
  import type { RawChannel, RawThreadMember, Channel, ThreadMember } from "./channel";
@@ -11,10 +11,10 @@ import type { RawUser, RawAvatarDecorationData, User, AvatarDecorationData } fro
11
11
  import type { RawVoiceState, VoiceState } from "./voice";
12
12
  /** https://discord.com/developers/docs/topics/gateway-events#payload-structure */
13
13
  export interface RawPayload {
14
- op: number;
14
+ op: GatewayOPCodes;
15
15
  d: any | null;
16
16
  s: number | null;
17
- t: string | null;
17
+ t: GatewayEvents | null;
18
18
  }
19
19
  /** https://discord.com/developers/docs/topics/gateway-events#identify-identify-structure */
20
20
  export interface RawIdentify {
@@ -356,7 +356,7 @@ export interface Payload {
356
356
  op: GatewayOPCodes;
357
357
  d: any | null;
358
358
  s: number | null;
359
- t: string | null;
359
+ t: GatewayEvents | null;
360
360
  }
361
361
  export interface Identify {
362
362
  token: string;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.3-dev.4f98e3d",
3
+ "version": "2.2.3-dev.f471c4a",
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": "2.2.3-dev.4f98e3d",
3
+ "version": "2.2.3-dev.f471c4a",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
@@ -1,10 +0,0 @@
1
- import type { Shard } from ".";
2
- import type { GatewayPresenceUpdate } from "../types/gateway-events";
3
- export declare class ShardManager extends Map<number, Shard> {
4
- /** https://discord.com/developers/docs/topics/gateway#connections */
5
- connect(): void;
6
- /** https://discord.com/developers/docs/topics/gateway#connections */
7
- disconnect(): void;
8
- /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
9
- updatePresence(options: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>): void;
10
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShardManager = void 0;
4
- class ShardManager extends Map {
5
- /** https://discord.com/developers/docs/topics/gateway#connections */
6
- connect() {
7
- this.forEach((shard) => shard.connect());
8
- }
9
- /** https://discord.com/developers/docs/topics/gateway#connections */
10
- disconnect() {
11
- this.forEach((shard) => shard.disconnect());
12
- }
13
- /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
14
- updatePresence(options) {
15
- this.forEach((shard) => shard.updatePresence(options));
16
- }
17
- }
18
- exports.ShardManager = ShardManager;