disgroove 2.0.0-dev.825fc77 → 2.0.1
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.
- package/README.md +9 -9
- package/dist/lib/Client.d.ts +10 -10
- package/dist/lib/Client.js +189 -189
- package/dist/lib/Client.js.map +1 -1
- package/dist/lib/constants.d.ts +3 -3
- package/dist/lib/constants.js +207 -207
- package/dist/lib/rest/Endpoints.d.ts +1 -1
- package/dist/lib/rest/Endpoints.js +3 -3
- package/dist/lib/rest/Endpoints.js.map +1 -1
- package/dist/lib/rest/RequestManager.d.ts +2 -2
- package/dist/lib/rest/RequestManager.js +17 -17
- package/dist/lib/types/application-command.d.ts +5 -5
- package/dist/lib/types/guild.d.ts +4 -4
- package/dist/lib/types/interaction.d.ts +6 -6
- package/dist/lib/utils/errors.d.ts +1 -1
- package/dist/lib/utils/errors.js +4 -4
- package/dist/package.json +9 -7
- package/package.json +9 -7
package/README.md
CHANGED
@@ -5,7 +5,7 @@ A module to interface with Discord
|
|
5
5
|
## Features
|
6
6
|
|
7
7
|
- No cache: For large bots the cache might be a RAM memory management issue, this module doesn't include it
|
8
|
-
- Very
|
8
|
+
- Very fast: The module contains all methods in the Client class, so sending API requests will not have to go through a third party, and this allows the module to be faster
|
9
9
|
- Documentation-based: The module is based entirely on the [Official Discord API Documentation](https://discord.com/developers/docs/intro), so it does not add custom methods or properties, to avoid future problems
|
10
10
|
|
11
11
|
## Installation
|
@@ -34,27 +34,27 @@ const client = new Client("token", {
|
|
34
34
|
});
|
35
35
|
|
36
36
|
client.on("ready", async () => {
|
37
|
-
console.log(`${client.user.username} is now online!`); //
|
37
|
+
console.log(`${client.user.username} is now online!`); // Prints "Username is now online!" when the bot connects to the gateway
|
38
38
|
|
39
|
-
client.application.
|
39
|
+
client.createGlobalApplicationCommand(client.application.id, {
|
40
40
|
name: "ping",
|
41
41
|
description: "Responds with Pong! 🏓",
|
42
|
-
}); //
|
42
|
+
}); // Creates a global application command named "ping"
|
43
43
|
|
44
44
|
client.setPresence({
|
45
45
|
activity: {
|
46
46
|
name: "/ping",
|
47
47
|
type: ActivityType.Watching,
|
48
48
|
},
|
49
|
-
}); //
|
49
|
+
}); // Updates the bot presence to "Watching /ping"
|
50
50
|
});
|
51
51
|
|
52
52
|
client.on("interactionCreate", async (interaction) => {
|
53
|
-
if (interaction.type !== InteractionType.ApplicationCommand) return; //
|
53
|
+
if (interaction.type !== InteractionType.ApplicationCommand) return; // Checks if the interaction is an application command
|
54
54
|
|
55
55
|
if (interaction.data.name === "ping") {
|
56
|
-
//
|
57
|
-
interaction.
|
56
|
+
// Checks if the application command name is equals to "ping"
|
57
|
+
client.createInteractionResponse(interaction.id, interaction.token, {
|
58
58
|
type: InteractionCallbackType.ChannelMessageWithSource,
|
59
59
|
data: {
|
60
60
|
content: "Pong! 🏓",
|
@@ -64,7 +64,7 @@ client.on("interactionCreate", async (interaction) => {
|
|
64
64
|
}
|
65
65
|
});
|
66
66
|
|
67
|
-
client.connect(); //
|
67
|
+
client.connect(); // Connects the bot to the gateway
|
68
68
|
```
|
69
69
|
|
70
70
|
Enjoy the package? Give it a ⭐ on [GitHub repository](https://github.com/XenKys/disgroove)
|
package/dist/lib/Client.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import { GatewayIntents, type OAuth2Scopes, type StatusTypes, type ActionTypes, type ImageWidgetStyleOptions, type MFALevel } from "./constants";
|
3
3
|
import { Util } from "./utils";
|
4
4
|
import { RequestManager } from "./rest";
|
5
|
-
import type { Activity, AuditLogEntry, AutoModerationActionExecutionEventFields, AutoModerationRule, Channel, ChannelPinsUpdateEventFields, GuildApplicationCommandPermissions, GuildBanAddEventFields, GuildBanRemoveEventFields, GuildMemberRemoveEventFields, GuildMemberUpdateEventFields, GuildMembersChunkEventFields, GuildScheduledEvent, IntegrationDeleteEventFields, InviteCreateEventFields, InviteDeleteEventFields, MessageDeleteBulkEventFields, MessageDeleteEventFields, MessageReactionAddEventFields, MessageReactionRemoveAllEventFields, MessageReactionRemoveEmojiEventFields, MessageReactionRemoveEventFields, PresenceUpdateEventFields, StageInstance, StickerPack, ThreadListSyncEventFields, ThreadMember, ThreadMembersUpdateEventFields, TypingStartEventFields, VoiceRegion, VoiceServerUpdateEventFields, Entitlement, UnavailableGuild, CreateGlobalApplicationCommandParams, ApplicationCommand, CreateGuildApplicationCommandParams, CreateTestEntitlementParams, EditCurrentApplicationParams, Application, EditGlobalApplicationCommandParams, EditGuildApplicationCommandParams, ApplicationRoleConnectionMetadata, Sku,
|
5
|
+
import type { Activity, AuditLogEntry, AutoModerationActionExecutionEventFields, AutoModerationRule, Channel, ChannelPinsUpdateEventFields, GuildApplicationCommandPermissions, GuildBanAddEventFields, GuildBanRemoveEventFields, GuildMemberRemoveEventFields, GuildMemberUpdateEventFields, GuildMembersChunkEventFields, GuildScheduledEvent, IntegrationDeleteEventFields, InviteCreateEventFields, InviteDeleteEventFields, MessageDeleteBulkEventFields, MessageDeleteEventFields, MessageReactionAddEventFields, MessageReactionRemoveAllEventFields, MessageReactionRemoveEmojiEventFields, MessageReactionRemoveEventFields, PresenceUpdateEventFields, StageInstance, StickerPack, ThreadListSyncEventFields, ThreadMember, ThreadMembersUpdateEventFields, TypingStartEventFields, VoiceRegion, VoiceServerUpdateEventFields, Entitlement, UnavailableGuild, CreateGlobalApplicationCommandParams, ApplicationCommand, CreateGuildApplicationCommandParams, CreateTestEntitlementParams, EditCurrentApplicationParams, Application, EditGlobalApplicationCommandParams, EditGuildApplicationCommandParams, ApplicationRoleConnectionMetadata, Sku, BulkEditGlobalApplicationCommandsParams, BulkEditGuildApplicationCommandsParams, CreateGuildParams, CreateGuildFromGuildTemplateParams, CreateStageInstanceParams, EditAutoModerationRuleParams, CreateChannelInviteParams, Invite, CreateMessageParams, Message, CreateThreadFromMessageParams, CreateThreadParams, CreateThreadWithoutMessageParams, Webhook, EditChannelParams, EditMessageParams, FollowedChannel, User, Emoji, EditGuildEmojiParams, AddGuildMemberParams, BeginGuildPruneParams, GuildMember, CreateAutoModerationRuleParams, CreateGuildBanParams, CreateGuildChannelParams, CreateGuildEmojiParams, CreateGuildRoleParams, Role, CreateGuildScheduledEventParams, CreateGuildStickerParams, CreateGuildTemplateParams, GuildTemplate, Sticker, EditGuildParams, Guild, EditGuildChannelPositionsParams, EditGuildMemberParams, EditCurrentUserVoiceStateParams, EditCurrentGuildMemberParams, EditGuildMFALevelParams, EditGuildOnboardingParams, EditGuildRolePositionsParams, EditGuildScheduledEventParams, EditGuildStickerParams, EditGuildTemplateParams, EditGuildWelcomeScreenParams, WelcomeScreen, GuildWidgetSettings, AuditLog, Ban, Integration, GuildOnboarding, GuildPreview, GuildScheduledEventUser, GuildWidget, ExecuteWebhookParams, CreateInteractionFollowupMessageParams, InteractionResponse, EditWebhookMessageParams, EditStageInstanceParams, CreateDMParams, EditCurrentUserParams, ApplicationRoleConnection, Connection, UpdateCurrentUserApplicationRoleConnection, EditWebhookParams, Interaction, VoiceState, GuildCreateEventExtraFields, GuildMemberAddEventExtraFields, IntegrationCreateEventExtraFields, IntegrationUpdateEventExtraFields, MessageCreateEventExtraFields, ThreadMemberUpdateEventExtraFields } from "./types";
|
6
6
|
import EventEmitter from "node:events";
|
7
7
|
import { ShardManager } from "./gateway";
|
8
8
|
export interface ClientOptions {
|
@@ -43,9 +43,9 @@ export declare class Client extends EventEmitter {
|
|
43
43
|
messagesIds?: Array<string>;
|
44
44
|
}, reason?: string): void;
|
45
45
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
|
46
|
-
bulkEditGlobalApplicationCommands(applicationId: string, commands:
|
46
|
+
bulkEditGlobalApplicationCommands(applicationId: string, commands: BulkEditGlobalApplicationCommandsParams): Promise<Array<ApplicationCommand>>;
|
47
47
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
48
|
-
bulkEditGuildApplicationCommands(applicationId: string, guildId: string, commands:
|
48
|
+
bulkEditGuildApplicationCommands(applicationId: string, guildId: string, commands: BulkEditGuildApplicationCommandsParams): Promise<Array<ApplicationCommand>>;
|
49
49
|
/** https://discord.com/developers/docs/topics/gateway#connections */
|
50
50
|
connect(): Promise<void>;
|
51
51
|
/** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
|
@@ -170,7 +170,7 @@ export declare class Client extends EventEmitter {
|
|
170
170
|
type: number;
|
171
171
|
}, reason?: string): void;
|
172
172
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
|
173
|
-
editChannelPositions(guildId: string, options:
|
173
|
+
editChannelPositions(guildId: string, options: EditGuildChannelPositionsParams): void;
|
174
174
|
/** https://discord.com/developers/docs/resources/user#modify-current-user */
|
175
175
|
editCurrentUser(options: EditCurrentUserParams): Promise<User>;
|
176
176
|
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
@@ -204,7 +204,7 @@ export declare class Client extends EventEmitter {
|
|
204
204
|
mentionable?: boolean | null;
|
205
205
|
}, reason?: string): Promise<Role>;
|
206
206
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
|
207
|
-
editGuildRolePositions(guildId: string, options:
|
207
|
+
editGuildRolePositions(guildId: string, options: EditGuildRolePositionsParams): Promise<Array<Role>>;
|
208
208
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
209
209
|
editGuildScheduledEvent(guildId: string, guildScheduledEventId: string, options: EditGuildScheduledEventParams, reason?: string): Promise<GuildScheduledEvent>;
|
210
210
|
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
|
@@ -290,8 +290,6 @@ export declare class Client extends EventEmitter {
|
|
290
290
|
getAutoModerationRules(guildId: string): Promise<Array<AutoModerationRule>>;
|
291
291
|
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
292
292
|
getApplicationCommandPermissions(applicationId: string, guildId: string, commandId: string): Promise<GuildApplicationCommandPermissions>;
|
293
|
-
/** https://discord.com/developers/docs/resources/user#get-user-application-role-connection */
|
294
|
-
getApplicationRoleConnection(applicationId: string): Promise<ApplicationRoleConnection>;
|
295
293
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
|
296
294
|
getApplicationRoleConnectionMetadataRecords(applicationId: string): Promise<Array<ApplicationRoleConnectionMetadata>>;
|
297
295
|
/** https://discord.com/developers/docs/resources/channel#get-channel */
|
@@ -302,12 +300,14 @@ export declare class Client extends EventEmitter {
|
|
302
300
|
getChannelInvites(channelId: string): Promise<Array<Invite>>;
|
303
301
|
/** https://discord.com/developers/docs/resources/webhook#get-channel-webhooks */
|
304
302
|
getChannelWebhooks(channelId: string): Promise<Array<Webhook>>;
|
305
|
-
/** https://discord.com/developers/docs/resources/user#get-user-connections */
|
306
|
-
getConnections(): Promise<Array<Connection>>;
|
307
303
|
/** https://discord.com/developers/docs/resources/application#get-current-application */
|
308
304
|
getCurrentApplication(): Promise<Application>;
|
305
|
+
/** https://discord.com/developers/docs/resources/user#get-current-user-application-role-connection */
|
306
|
+
getCurrentApplicationRoleConnection(applicationId: string): Promise<ApplicationRoleConnection>;
|
309
307
|
/** https://discord.com/developers/docs/resources/user#get-current-user-guild-member */
|
310
308
|
getCurrentGuildMember(guildId: string): Promise<GuildMember>;
|
309
|
+
/** https://discord.com/developers/docs/resources/user#get-current-user-connections */
|
310
|
+
getCurrentUserConnections(): Promise<Array<Connection>>;
|
311
311
|
/** https://discord.com/developers/docs/monetization/entitlements#list-entitlements */
|
312
312
|
getEntitlements(applicationId: string, options?: {
|
313
313
|
userId?: string;
|
@@ -545,7 +545,7 @@ export declare class Client extends EventEmitter {
|
|
545
545
|
triggerTypingIndicator(channelId: string): void;
|
546
546
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
|
547
547
|
updateApplicationRoleConnectionMetadataRecords(applicationId: string): Promise<Array<ApplicationRoleConnectionMetadata>>;
|
548
|
-
/** https://discord.com/developers/docs/resources/user#update-user-application-role-connection */
|
548
|
+
/** https://discord.com/developers/docs/resources/user#update-current-user-application-role-connection */
|
549
549
|
updateCurrentApplicationRoleConnection(options: UpdateCurrentUserApplicationRoleConnection): Promise<ApplicationRoleConnection>;
|
550
550
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
551
551
|
unpinMessage(channelId: string, messageId: string, reason?: string): void;
|