@buape/carbon 0.0.0-beta-20241008010229
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/LICENSE +21 -0
- package/README.md +52 -0
- package/dist/package.json +34 -0
- package/dist/src/abstracts/AnySelectMenu.d.ts +31 -0
- package/dist/src/abstracts/AnySelectMenu.d.ts.map +1 -0
- package/dist/src/abstracts/AnySelectMenu.js +19 -0
- package/dist/src/abstracts/AnySelectMenu.js.map +1 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts +13 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.js +21 -0
- package/dist/src/abstracts/AnySelectMenuInteraction.js.map +1 -0
- package/dist/src/abstracts/Base.d.ts +10 -0
- package/dist/src/abstracts/Base.d.ts.map +1 -0
- package/dist/src/abstracts/Base.js +11 -0
- package/dist/src/abstracts/Base.js.map +1 -0
- package/dist/src/abstracts/BaseChannel.d.ts +45 -0
- package/dist/src/abstracts/BaseChannel.d.ts.map +1 -0
- package/dist/src/abstracts/BaseChannel.js +68 -0
- package/dist/src/abstracts/BaseChannel.js.map +1 -0
- package/dist/src/abstracts/BaseCommand.d.ts +58 -0
- package/dist/src/abstracts/BaseCommand.d.ts.map +1 -0
- package/dist/src/abstracts/BaseCommand.js +72 -0
- package/dist/src/abstracts/BaseCommand.js.map +1 -0
- package/dist/src/abstracts/BaseComponent.d.ts +34 -0
- package/dist/src/abstracts/BaseComponent.d.ts.map +1 -0
- package/dist/src/abstracts/BaseComponent.js +30 -0
- package/dist/src/abstracts/BaseComponent.js.map +1 -0
- package/dist/src/abstracts/BaseComponentInteraction.d.ts +19 -0
- package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/BaseComponentInteraction.js +42 -0
- package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -0
- package/dist/src/abstracts/BaseGuildChannel.d.ts +70 -0
- package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -0
- package/dist/src/abstracts/BaseGuildChannel.js +143 -0
- package/dist/src/abstracts/BaseGuildChannel.js.map +1 -0
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts +46 -0
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -0
- package/dist/src/abstracts/BaseGuildTextChannel.js +77 -0
- package/dist/src/abstracts/BaseGuildTextChannel.js.map +1 -0
- package/dist/src/abstracts/BaseInteraction.d.ts +92 -0
- package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -0
- package/dist/src/abstracts/BaseInteraction.js +152 -0
- package/dist/src/abstracts/BaseInteraction.js.map +1 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +43 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.js +69 -0
- package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -0
- package/dist/src/classes/Button.d.ts +49 -0
- package/dist/src/classes/Button.d.ts.map +1 -0
- package/dist/src/classes/Button.js +61 -0
- package/dist/src/classes/Button.js.map +1 -0
- package/dist/src/classes/ChannelSelectMenu.d.ts +15 -0
- package/dist/src/classes/ChannelSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/ChannelSelectMenu.js +15 -0
- package/dist/src/classes/ChannelSelectMenu.js.map +1 -0
- package/dist/src/classes/Client.d.ts +180 -0
- package/dist/src/classes/Client.d.ts.map +1 -0
- package/dist/src/classes/Client.js +263 -0
- package/dist/src/classes/Client.js.map +1 -0
- package/dist/src/classes/Command.d.ts +33 -0
- package/dist/src/classes/Command.d.ts.map +1 -0
- package/dist/src/classes/Command.js +31 -0
- package/dist/src/classes/Command.js.map +1 -0
- package/dist/src/classes/CommandWithSubcommandGroups.d.ts +22 -0
- package/dist/src/classes/CommandWithSubcommandGroups.d.ts.map +1 -0
- package/dist/src/classes/CommandWithSubcommandGroups.js +31 -0
- package/dist/src/classes/CommandWithSubcommandGroups.js.map +1 -0
- package/dist/src/classes/CommandWithSubcommands.d.ts +19 -0
- package/dist/src/classes/CommandWithSubcommands.d.ts.map +1 -0
- package/dist/src/classes/CommandWithSubcommands.js +21 -0
- package/dist/src/classes/CommandWithSubcommands.js.map +1 -0
- package/dist/src/classes/Embed.d.ts +61 -0
- package/dist/src/classes/Embed.d.ts.map +1 -0
- package/dist/src/classes/Embed.js +75 -0
- package/dist/src/classes/Embed.js.map +1 -0
- package/dist/src/classes/MentionableSelectMenu.d.ts +13 -0
- package/dist/src/classes/MentionableSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/MentionableSelectMenu.js +13 -0
- package/dist/src/classes/MentionableSelectMenu.js.map +1 -0
- package/dist/src/classes/Modal.d.ts +21 -0
- package/dist/src/classes/Modal.d.ts.map +1 -0
- package/dist/src/classes/Modal.js +14 -0
- package/dist/src/classes/Modal.js.map +1 -0
- package/dist/src/classes/RoleSelectMenu.d.ts +13 -0
- package/dist/src/classes/RoleSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/RoleSelectMenu.js +13 -0
- package/dist/src/classes/RoleSelectMenu.js.map +1 -0
- package/dist/src/classes/Row.d.ts +25 -0
- package/dist/src/classes/Row.d.ts.map +1 -0
- package/dist/src/classes/Row.js +40 -0
- package/dist/src/classes/Row.js.map +1 -0
- package/dist/src/classes/StringSelectMenu.d.ts +13 -0
- package/dist/src/classes/StringSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/StringSelectMenu.js +12 -0
- package/dist/src/classes/StringSelectMenu.js.map +1 -0
- package/dist/src/classes/TextInput.d.ts +40 -0
- package/dist/src/classes/TextInput.d.ts.map +1 -0
- package/dist/src/classes/TextInput.js +44 -0
- package/dist/src/classes/TextInput.js.map +1 -0
- package/dist/src/classes/UserSelectMenu.d.ts +13 -0
- package/dist/src/classes/UserSelectMenu.d.ts.map +1 -0
- package/dist/src/classes/UserSelectMenu.js +13 -0
- package/dist/src/classes/UserSelectMenu.js.map +1 -0
- package/dist/src/factories/channelFactory.d.ts +13 -0
- package/dist/src/factories/channelFactory.d.ts.map +1 -0
- package/dist/src/factories/channelFactory.js +39 -0
- package/dist/src/factories/channelFactory.js.map +1 -0
- package/dist/src/index.d.ts +55 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +61 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internals/AutocompleteInteraction.d.ts +33 -0
- package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -0
- package/dist/src/internals/AutocompleteInteraction.js +61 -0
- package/dist/src/internals/AutocompleteInteraction.js.map +1 -0
- package/dist/src/internals/ButtonInteraction.d.ts +9 -0
- package/dist/src/internals/ButtonInteraction.d.ts.map +1 -0
- package/dist/src/internals/ButtonInteraction.js +18 -0
- package/dist/src/internals/ButtonInteraction.js.map +1 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.d.ts +8 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.js +11 -0
- package/dist/src/internals/ChannelSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/CommandHandler.d.ts +12 -0
- package/dist/src/internals/CommandHandler.d.ts.map +1 -0
- package/dist/src/internals/CommandHandler.js +89 -0
- package/dist/src/internals/CommandHandler.js.map +1 -0
- package/dist/src/internals/CommandInteraction.d.ts +16 -0
- package/dist/src/internals/CommandInteraction.d.ts.map +1 -0
- package/dist/src/internals/CommandInteraction.js +23 -0
- package/dist/src/internals/CommandInteraction.js.map +1 -0
- package/dist/src/internals/ComponentHandler.d.ts +17 -0
- package/dist/src/internals/ComponentHandler.d.ts.map +1 -0
- package/dist/src/internals/ComponentHandler.js +75 -0
- package/dist/src/internals/ComponentHandler.js.map +1 -0
- package/dist/src/internals/FieldsHandler.d.ts +27 -0
- package/dist/src/internals/FieldsHandler.d.ts.map +1 -0
- package/dist/src/internals/FieldsHandler.js +37 -0
- package/dist/src/internals/FieldsHandler.js.map +1 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.d.ts +9 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.js +15 -0
- package/dist/src/internals/MentionableSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/ModalHandler.d.ts +17 -0
- package/dist/src/internals/ModalHandler.d.ts.map +1 -0
- package/dist/src/internals/ModalHandler.js +25 -0
- package/dist/src/internals/ModalHandler.js.map +1 -0
- package/dist/src/internals/ModalInteraction.d.ts +22 -0
- package/dist/src/internals/ModalInteraction.d.ts.map +1 -0
- package/dist/src/internals/ModalInteraction.js +42 -0
- package/dist/src/internals/ModalInteraction.js.map +1 -0
- package/dist/src/internals/OptionsHandler.d.ts +82 -0
- package/dist/src/internals/OptionsHandler.d.ts.map +1 -0
- package/dist/src/internals/OptionsHandler.js +127 -0
- package/dist/src/internals/OptionsHandler.js.map +1 -0
- package/dist/src/internals/RoleSelectMenuInteraction.d.ts +9 -0
- package/dist/src/internals/RoleSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/RoleSelectMenuInteraction.js +14 -0
- package/dist/src/internals/RoleSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/StringSelectMenuInteraction.d.ts +9 -0
- package/dist/src/internals/StringSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/StringSelectMenuInteraction.js +14 -0
- package/dist/src/internals/StringSelectMenuInteraction.js.map +1 -0
- package/dist/src/internals/UserSelectMenuInteraction.d.ts +9 -0
- package/dist/src/internals/UserSelectMenuInteraction.d.ts.map +1 -0
- package/dist/src/internals/UserSelectMenuInteraction.js +14 -0
- package/dist/src/internals/UserSelectMenuInteraction.js.map +1 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.d.ts +49 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.d.ts.map +1 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.js +164 -0
- package/dist/src/plugins/linked-roles/LinkedRoles.js.map +1 -0
- package/dist/src/plugins/linked-roles/index.d.ts +3 -0
- package/dist/src/plugins/linked-roles/index.d.ts.map +1 -0
- package/dist/src/plugins/linked-roles/index.js +3 -0
- package/dist/src/plugins/linked-roles/index.js.map +1 -0
- package/dist/src/plugins/linked-roles/types.d.ts +88 -0
- package/dist/src/plugins/linked-roles/types.d.ts.map +1 -0
- package/dist/src/plugins/linked-roles/types.js +39 -0
- package/dist/src/plugins/linked-roles/types.js.map +1 -0
- package/dist/src/structures/DmChannel.d.ts +19 -0
- package/dist/src/structures/DmChannel.d.ts.map +1 -0
- package/dist/src/structures/DmChannel.js +25 -0
- package/dist/src/structures/DmChannel.js.map +1 -0
- package/dist/src/structures/GroupDmChannel.d.ts +65 -0
- package/dist/src/structures/GroupDmChannel.d.ts.map +1 -0
- package/dist/src/structures/GroupDmChannel.js +116 -0
- package/dist/src/structures/GroupDmChannel.js.map +1 -0
- package/dist/src/structures/Guild.d.ts +77 -0
- package/dist/src/structures/Guild.d.ts.map +1 -0
- package/dist/src/structures/Guild.js +156 -0
- package/dist/src/structures/Guild.js.map +1 -0
- package/dist/src/structures/GuildAnnouncementChannel.d.ts +11 -0
- package/dist/src/structures/GuildAnnouncementChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildAnnouncementChannel.js +15 -0
- package/dist/src/structures/GuildAnnouncementChannel.js.map +1 -0
- package/dist/src/structures/GuildCategoryChannel.d.ts +13 -0
- package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildCategoryChannel.js +13 -0
- package/dist/src/structures/GuildCategoryChannel.js.map +1 -0
- package/dist/src/structures/GuildForumChannel.d.ts +14 -0
- package/dist/src/structures/GuildForumChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildForumChannel.js +15 -0
- package/dist/src/structures/GuildForumChannel.js.map +1 -0
- package/dist/src/structures/GuildMediaChannel.d.ts +9 -0
- package/dist/src/structures/GuildMediaChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildMediaChannel.js +7 -0
- package/dist/src/structures/GuildMediaChannel.js.map +1 -0
- package/dist/src/structures/GuildMember.d.ts +111 -0
- package/dist/src/structures/GuildMember.d.ts.map +1 -0
- package/dist/src/structures/GuildMember.js +224 -0
- package/dist/src/structures/GuildMember.js.map +1 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts +31 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.js +43 -0
- package/dist/src/structures/GuildStageOrVoiceChannel.js.map +1 -0
- package/dist/src/structures/GuildTextChannel.d.ts +15 -0
- package/dist/src/structures/GuildTextChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildTextChannel.js +20 -0
- package/dist/src/structures/GuildTextChannel.js.map +1 -0
- package/dist/src/structures/GuildThreadChannel.d.ts +90 -0
- package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -0
- package/dist/src/structures/GuildThreadChannel.js +165 -0
- package/dist/src/structures/GuildThreadChannel.js.map +1 -0
- package/dist/src/structures/Message.d.ts +153 -0
- package/dist/src/structures/Message.d.ts.map +1 -0
- package/dist/src/structures/Message.js +296 -0
- package/dist/src/structures/Message.js.map +1 -0
- package/dist/src/structures/Role.d.ts +108 -0
- package/dist/src/structures/Role.d.ts.map +1 -0
- package/dist/src/structures/Role.js +220 -0
- package/dist/src/structures/Role.js.map +1 -0
- package/dist/src/structures/User.d.ts +82 -0
- package/dist/src/structures/User.d.ts.map +1 -0
- package/dist/src/structures/User.js +166 -0
- package/dist/src/structures/User.js.map +1 -0
- package/dist/src/types.d.ts +37 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.d.ts +22 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +79 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Buape Studios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Carbon
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="https://go.buape.com/carbon"><img src="https://cdn.buape.com/CarbonWordmark.png" alt="Carbon Wordmark"></a>
|
|
5
|
+
|
|
6
|
+
<img alt="Discord" src="https://img.shields.io/discord/1280628625904894072?style=for-the-badge">
|
|
7
|
+
<img alt="NPM Version" src="https://img.shields.io/npm/v/@buape/carbon?style=for-the-badge">
|
|
8
|
+
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@buape/carbon?style=for-the-badge">
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
Carbon is a fully-featured framework for building HTTP Discord bots, built in TypeScript and designed to be easy to use and understand.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Fully up to date with the Discord API
|
|
16
|
+
- Build to be both flexible and powerful
|
|
17
|
+
- Easy to use class-based system for reusability
|
|
18
|
+
- Built in pagination support (Soon!)
|
|
19
|
+
- Integration with Discord's Monetization (Soon!)
|
|
20
|
+
|
|
21
|
+
## Why Carbon?
|
|
22
|
+
|
|
23
|
+
Carbon is designed to be easy to use and understand, while still providing the flexibility and power needed to build complex bots.
|
|
24
|
+
With Carbon, you can deploy it to many platforms, both physical and serverless, and it's easy to integrate with other frameworks and libraries.
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
To get started with Carbon, you can check out the [Getting Started](https://carbon.buape.com/carbon/getting-started) guides for your preferred platform.
|
|
29
|
+
|
|
30
|
+
## Useful Links
|
|
31
|
+
|
|
32
|
+
- [Documentation](https://carbon.buape.com/carbon)
|
|
33
|
+
- [Discord](https://go.buape.com/carbon)
|
|
34
|
+
- [NPM](https://www.npmjs.com/package/@buape/carbon)
|
|
35
|
+
- [Cloudflare Workers Demo](https://github.com/buape/carbon/tree/main/apps/cloudo)
|
|
36
|
+
- [Node.js Demo](https://github.com/buape/carbon/tree/main/apps/rocko)
|
|
37
|
+
|
|
38
|
+
## Contributing
|
|
39
|
+
|
|
40
|
+
We welcome contributions to Carbon! If you're interested in contributing, please check out the [Contributing Guide](https://carbon.buape.com/carbon/helpful-guides/contributing) for more information, and join our [Discord](https://go.buape.com/carbon) to get involved!
|
|
41
|
+
|
|
42
|
+
### All Contributors
|
|
43
|
+
|
|
44
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
45
|
+
<!-- prettier-ignore-start -->
|
|
46
|
+
<!-- markdownlint-disable -->
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
50
|
+
|
|
51
|
+
<!-- markdownlint-restore -->
|
|
52
|
+
<!-- prettier-ignore-end -->
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@buape/carbon",
|
|
3
|
+
"version": "0.0.0-beta-20241008010229",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/src/index.js",
|
|
6
|
+
"repository": "github:buape/carbon",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/src/index.d.ts",
|
|
10
|
+
"import": "./dist/src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./*": {
|
|
13
|
+
"types": "./dist/src/plugins/*/index.d.ts",
|
|
14
|
+
"import": "./dist/src/plugins/*/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsc -w",
|
|
20
|
+
"docs": "typedoc"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@buape/carbon-request": "workspace:*",
|
|
25
|
+
"@types/node": "^20",
|
|
26
|
+
"discord-api-types": "0.37.101",
|
|
27
|
+
"discord-verify": "1.2.0",
|
|
28
|
+
"itty-router": "5.0.18"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { APIChannelSelectComponent, APIMentionableSelectComponent, APIRoleSelectComponent, APISelectMenuComponent, APIStringSelectComponent, APIUserSelectComponent, ComponentType } from "discord-api-types/v10";
|
|
2
|
+
import type { AnySelectMenuInteraction } from "./AnySelectMenuInteraction.js";
|
|
3
|
+
import { BaseComponent } from "./BaseComponent.js";
|
|
4
|
+
export type AnySelectMenuComponentType = ComponentType.ChannelSelect | ComponentType.RoleSelect | ComponentType.StringSelect | ComponentType.UserSelect | ComponentType.MentionableSelect;
|
|
5
|
+
export declare abstract class AnySelectMenu extends BaseComponent {
|
|
6
|
+
abstract type: AnySelectMenuComponentType;
|
|
7
|
+
abstract run(interaction: AnySelectMenuInteraction): Promise<void>;
|
|
8
|
+
minValues?: number;
|
|
9
|
+
maxValues?: number;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
serialize: () => APISelectMenuComponent;
|
|
13
|
+
abstract serializeOptions(): {
|
|
14
|
+
type: ComponentType.ChannelSelect;
|
|
15
|
+
channel_types: APIChannelSelectComponent["channel_types"];
|
|
16
|
+
default_values: APIChannelSelectComponent["default_values"];
|
|
17
|
+
} | {
|
|
18
|
+
type: ComponentType.StringSelect;
|
|
19
|
+
options: APIStringSelectComponent["options"];
|
|
20
|
+
} | {
|
|
21
|
+
type: ComponentType.RoleSelect;
|
|
22
|
+
default_values: APIRoleSelectComponent["default_values"];
|
|
23
|
+
} | {
|
|
24
|
+
type: ComponentType.UserSelect;
|
|
25
|
+
default_values: APIUserSelectComponent["default_values"];
|
|
26
|
+
} | {
|
|
27
|
+
type: ComponentType.MentionableSelect;
|
|
28
|
+
default_values: APIMentionableSelectComponent["default_values"];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=AnySelectMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnySelectMenu.d.ts","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,aAAa,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,MAAM,MAAM,0BAA0B,GACnC,aAAa,CAAC,aAAa,GAC3B,aAAa,CAAC,UAAU,GACxB,aAAa,CAAC,YAAY,GAC1B,aAAa,CAAC,UAAU,GACxB,aAAa,CAAC,iBAAiB,CAAA;AAElC,8BAAsB,aAAc,SAAQ,aAAa;IACxD,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAA;IACzC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAElE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,SAAS,QAAO,sBAAsB,CAUrC;IAED,QAAQ,CAAC,gBAAgB,IACtB;QACA,IAAI,EAAE,aAAa,CAAC,aAAa,CAAA;QACjC,aAAa,EAAE,yBAAyB,CAAC,eAAe,CAAC,CAAA;QACzD,cAAc,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAA;KAC1D,GACD;QACA,IAAI,EAAE,aAAa,CAAC,YAAY,CAAA;QAChC,OAAO,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAA;KAC3C,GACD;QACA,IAAI,EAAE,aAAa,CAAC,UAAU,CAAA;QAC9B,cAAc,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;KACvD,GACD;QACA,IAAI,EAAE,aAAa,CAAC,UAAU,CAAA;QAC9B,cAAc,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;KACvD,GACD;QACA,IAAI,EAAE,aAAa,CAAC,iBAAiB,CAAA;QACrC,cAAc,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,CAAA;KAC9D;CACJ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseComponent } from "./BaseComponent.js";
|
|
2
|
+
export class AnySelectMenu extends BaseComponent {
|
|
3
|
+
minValues;
|
|
4
|
+
maxValues;
|
|
5
|
+
disabled;
|
|
6
|
+
placeholder;
|
|
7
|
+
serialize = () => {
|
|
8
|
+
const options = this.serializeOptions();
|
|
9
|
+
return {
|
|
10
|
+
...options,
|
|
11
|
+
custom_id: this.customId,
|
|
12
|
+
disabled: this.disabled,
|
|
13
|
+
placeholder: this.placeholder,
|
|
14
|
+
min_values: this.minValues,
|
|
15
|
+
max_values: this.maxValues
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=AnySelectMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnySelectMenu.js","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenu.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AASlD,MAAM,OAAgB,aAAc,SAAQ,aAAa;IAIxD,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,QAAQ,CAAU;IAClB,WAAW,CAAS;IAEpB,SAAS,GAAG,GAA2B,EAAE;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAA;QACvC,OAAO;YACN,GAAG,OAAO;YACV,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,UAAU,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAA;IACF,CAAC,CAAA;CAwBD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type APIMessageComponentSelectMenuInteraction } from "discord-api-types/v10";
|
|
2
|
+
import type { Client } from "../classes/Client.js";
|
|
3
|
+
import { BaseComponentInteraction } from "./BaseComponentInteraction.js";
|
|
4
|
+
import type { InteractionDefaults } from "./BaseInteraction.js";
|
|
5
|
+
export declare abstract class AnySelectMenuInteraction extends BaseComponentInteraction {
|
|
6
|
+
customId: string;
|
|
7
|
+
constructor(client: Client, data: APIMessageComponentSelectMenuInteraction, defaults: InteractionDefaults);
|
|
8
|
+
/**
|
|
9
|
+
* The raw IDs of the selected options (either role/string/channel IDs or the IDs you provided in your options)
|
|
10
|
+
*/
|
|
11
|
+
get values(): string[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=AnySelectMenuInteraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnySelectMenuInteraction.d.ts","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,wCAAwC,EAG7C,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE/D,8BAAsB,wBAAyB,SAAQ,wBAAwB;IAC9E,QAAQ,EAAE,MAAM,CAEZ;gBAEH,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,wCAAwC,EAC9C,QAAQ,EAAE,mBAAmB;IAU9B;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;CACD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InteractionType } from "discord-api-types/v10";
|
|
2
|
+
import { splitCustomId } from "../utils.js";
|
|
3
|
+
import { BaseComponentInteraction } from "./BaseComponentInteraction.js";
|
|
4
|
+
export class AnySelectMenuInteraction extends BaseComponentInteraction {
|
|
5
|
+
customId = splitCustomId(this.rawData.data.custom_id)[0];
|
|
6
|
+
constructor(client, data, defaults) {
|
|
7
|
+
super(client, data, defaults);
|
|
8
|
+
if (!data.data)
|
|
9
|
+
throw new Error("Invalid interaction data was used to create this class");
|
|
10
|
+
if (data.type !== InteractionType.MessageComponent) {
|
|
11
|
+
throw new Error("Invalid interaction type was used to create this class");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The raw IDs of the selected options (either role/string/channel IDs or the IDs you provided in your options)
|
|
16
|
+
*/
|
|
17
|
+
get values() {
|
|
18
|
+
return this.rawData.data.values;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=AnySelectMenuInteraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnySelectMenuInteraction.js","sourceRoot":"","sources":["../../../src/abstracts/AnySelectMenuInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,eAAe,EACf,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAGxE,MAAM,OAAgB,wBAAyB,SAAQ,wBAAwB;IAC9E,QAAQ,GAAW,aAAa,CAC9B,IAAI,CAAC,OAAO,CAAC,IAA4C,CAAC,SAAS,CACpE,CAAC,CAAC,CAAC,CAAA;IACJ,YACC,MAAc,EACd,IAA8C,EAC9C,QAA6B;QAE7B,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI;YACb,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,gBAAgB,EAAE,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;QAC1E,CAAC;IACF,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACT,OAAQ,IAAI,CAAC,OAAO,CAAC,IAA4C,CAAC,MAAM,CAAA;IACzE,CAAC;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../../src/abstracts/Base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD;;;GAGG;AACH,qBAAa,IAAI;IAChB,MAAM,EAAE,MAAM,CAAA;gBACF,MAAM,EAAE,MAAM;CAG1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../src/abstracts/Base.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,IAAI;IAChB,MAAM,CAAQ;IACd,YAAY,MAAc;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACrB,CAAC;CACD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type APIChannel, type ChannelFlags, type ChannelType } from "discord-api-types/v10";
|
|
2
|
+
import type { Client } from "../classes/Client.js";
|
|
3
|
+
import type { IfPartial } from "../utils.js";
|
|
4
|
+
import { Base } from "./Base.js";
|
|
5
|
+
export declare abstract class BaseChannel<Type extends ChannelType, IsPartial extends boolean = false> extends Base {
|
|
6
|
+
constructor(client: Client, rawDataOrId: IsPartial extends true ? string : Extract<APIChannel, {
|
|
7
|
+
type: Type;
|
|
8
|
+
}>);
|
|
9
|
+
/**
|
|
10
|
+
* The raw data of the channel.
|
|
11
|
+
*/
|
|
12
|
+
protected rawData: Extract<APIChannel, {
|
|
13
|
+
type: Type;
|
|
14
|
+
}> | null;
|
|
15
|
+
protected setData(data: Extract<APIChannel, {
|
|
16
|
+
type: Type;
|
|
17
|
+
}>): void;
|
|
18
|
+
protected setField(field: keyof Extract<APIChannel, {
|
|
19
|
+
type: Type;
|
|
20
|
+
}>, value: unknown): void;
|
|
21
|
+
/**
|
|
22
|
+
* The id of the channel.
|
|
23
|
+
*/
|
|
24
|
+
readonly id: string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the channel is a partial channel (meaning it does not have all the data).
|
|
27
|
+
* If this is true, you should use {@link BaseChannel.fetch} to get the full data of the channel.
|
|
28
|
+
*/
|
|
29
|
+
get partial(): IsPartial;
|
|
30
|
+
/**
|
|
31
|
+
* The type of the channel.
|
|
32
|
+
*/
|
|
33
|
+
get type(): IfPartial<IsPartial, Type>;
|
|
34
|
+
/**
|
|
35
|
+
* The flags of the channel in a bitfield.
|
|
36
|
+
* @see https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
|
37
|
+
*/
|
|
38
|
+
get flags(): IfPartial<IsPartial, ChannelFlags | undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* Fetches the channel from the API.
|
|
41
|
+
* @returns The channel data.
|
|
42
|
+
*/
|
|
43
|
+
fetch(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=BaseChannel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,8BAAsB,WAAW,CAChC,IAAI,SAAS,WAAW,EACxB,SAAS,SAAS,OAAO,GAAG,KAAK,CAChC,SAAQ,IAAI;gBAEZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,SAAS,SAAS,IAAI,GAChC,MAAM,GACN,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;IAYvC;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,GAAG,IAAI,CAAO;IACpE,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;IAI3D,SAAS,CAAC,QAAQ,CACjB,KAAK,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,EAChD,KAAK,EAAE,OAAO;IAOf;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IAEnB;;;OAGG;IACH,IAAI,OAAO,IAAI,SAAS,CAEvB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAGrC;IAED;;;OAGG;IACH,IAAI,KAAK,IAAI,SAAS,CAAC,SAAS,EAAE,YAAY,GAAG,SAAS,CAAC,CAG1D;IAED;;;OAGG;IACG,KAAK;CAQX"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Routes } from "discord-api-types/v10";
|
|
2
|
+
import { Base } from "./Base.js";
|
|
3
|
+
export class BaseChannel extends Base {
|
|
4
|
+
constructor(client, rawDataOrId) {
|
|
5
|
+
super(client);
|
|
6
|
+
if (typeof rawDataOrId === "string") {
|
|
7
|
+
this.id = rawDataOrId;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
this.rawData = rawDataOrId;
|
|
11
|
+
this.id = rawDataOrId.id;
|
|
12
|
+
this.setData(rawDataOrId);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The raw data of the channel.
|
|
17
|
+
*/
|
|
18
|
+
rawData = null;
|
|
19
|
+
setData(data) {
|
|
20
|
+
if (!data)
|
|
21
|
+
throw new Error("Cannot set data without having data... smh");
|
|
22
|
+
this.rawData = data;
|
|
23
|
+
}
|
|
24
|
+
setField(field, value) {
|
|
25
|
+
if (!this.rawData)
|
|
26
|
+
throw new Error("Cannot set field without having data... smh");
|
|
27
|
+
this.rawData[field] = value;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The id of the channel.
|
|
31
|
+
*/
|
|
32
|
+
id;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the channel is a partial channel (meaning it does not have all the data).
|
|
35
|
+
* If this is true, you should use {@link BaseChannel.fetch} to get the full data of the channel.
|
|
36
|
+
*/
|
|
37
|
+
get partial() {
|
|
38
|
+
return (this.rawData === null);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The type of the channel.
|
|
42
|
+
*/
|
|
43
|
+
get type() {
|
|
44
|
+
if (!this.rawData)
|
|
45
|
+
return undefined;
|
|
46
|
+
return this.rawData.type;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The flags of the channel in a bitfield.
|
|
50
|
+
* @see https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
|
51
|
+
*/
|
|
52
|
+
get flags() {
|
|
53
|
+
if (!this.rawData)
|
|
54
|
+
return undefined;
|
|
55
|
+
return this.rawData.flags;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Fetches the channel from the API.
|
|
59
|
+
* @returns The channel data.
|
|
60
|
+
*/
|
|
61
|
+
async fetch() {
|
|
62
|
+
const newData = (await this.client.rest.get(Routes.channel(this.id)));
|
|
63
|
+
if (!newData)
|
|
64
|
+
throw new Error(`Channel ${this.id} not found`);
|
|
65
|
+
this.setData(newData);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=BaseChannel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseChannel.js","sourceRoot":"","sources":["../../../src/abstracts/BaseChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,MAAM,EACN,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,OAAgB,WAGpB,SAAQ,IAAI;IACb,YACC,MAAc,EACd,WAEsC;QAEtC,KAAK,CAAC,MAAM,CAAC,CAAA;QACb,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,EAAE,GAAG,WAAW,CAAA;QACtB,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,OAAO,GAAG,WAAoB,CAAA;YACnC,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC,EAAE,CAAA;YACxB,IAAI,CAAC,OAAO,CAAC,WAAoB,CAAC,CAAA;QACnC,CAAC;IACF,CAAC;IAED;;OAEG;IACO,OAAO,GAA+C,IAAI,CAAA;IAC1D,OAAO,CAAC,IAAyC;QAC1D,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;QACxE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;IACpB,CAAC;IACS,QAAQ,CACjB,KAAgD,EAChD,KAAc;QAEd,IAAI,CAAC,IAAI,CAAC,OAAO;YAChB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;QAC/D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAA;IAC5B,CAAC;IAED;;OAEG;IACM,EAAE,CAAQ;IAEnB;;;OAGG;IACH,IAAI,OAAO;QACV,OAAO,CAAC,IAAI,CAAC,OAAO,KAAK,IAAI,CAAU,CAAA;IACxC,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACP,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;IACzB,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACR,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAA;IAC1B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACV,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAC1C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CACvB,CAAwC,CAAA;QACzC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,EAAE,YAAY,CAAC,CAAA;QAE7D,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACtB,CAAC;CACD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ApplicationCommandType, type RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v10";
|
|
2
|
+
import { ApplicationIntegrationType, type BaseComponent, InteractionContextType, type Modal } from "../index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Represents the base data of a command that the user creates
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the command (e.g. "ping" for /ping)
|
|
9
|
+
*/
|
|
10
|
+
abstract name: string;
|
|
11
|
+
/**
|
|
12
|
+
* A description of the command
|
|
13
|
+
*/
|
|
14
|
+
abstract description: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the command response should be automatically deferred
|
|
17
|
+
*/
|
|
18
|
+
defer: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the command response should be ephemeral
|
|
21
|
+
*/
|
|
22
|
+
ephemeral: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The type of the command
|
|
25
|
+
*/
|
|
26
|
+
abstract type: ApplicationCommandType;
|
|
27
|
+
/**
|
|
28
|
+
* The places this command can be used in
|
|
29
|
+
* @beta API types are not finalized
|
|
30
|
+
*/
|
|
31
|
+
integrationTypes: ApplicationIntegrationType[];
|
|
32
|
+
/**
|
|
33
|
+
* The contexts this command can be used in
|
|
34
|
+
* @beta API types are not finalized
|
|
35
|
+
*/
|
|
36
|
+
contexts: InteractionContextType[];
|
|
37
|
+
/**
|
|
38
|
+
* The components that the command is able to use.
|
|
39
|
+
* You pass these here so the handler can listen for them..
|
|
40
|
+
*/
|
|
41
|
+
components: (new () => BaseComponent)[];
|
|
42
|
+
/**
|
|
43
|
+
* All the modals that the command is able to use.
|
|
44
|
+
* You pass these here so the handler can listen for them.
|
|
45
|
+
*/
|
|
46
|
+
modals: (new () => Modal)[];
|
|
47
|
+
/**
|
|
48
|
+
* Serializes the command into a JSON object that can be sent to Discord
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
serialize(): import("discord-api-types/v10").RESTPostAPIChatInputApplicationCommandsJSONBody | import("discord-api-types/v10").RESTPostAPIContextMenuApplicationCommandsJSONBody;
|
|
52
|
+
/**
|
|
53
|
+
* Serializes the options of the command into a JSON object that can be sent to Discord
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
abstract serializeOptions(): RESTPostAPIApplicationCommandsJSONBody["options"];
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=BaseCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseCommand.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EACtB,KAAK,sCAAsC,EAC3C,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,0BAA0B,EAC1B,KAAK,aAAa,EAClB,sBAAsB,EACtB,KAAK,KAAK,EACV,MAAM,aAAa,CAAA;AAEpB;;GAEG;AACH,8BAAsB,WAAW;IAChC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,KAAK,UAAQ;IACb;;OAEG;IACH,SAAS,UAAQ;IACjB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAA;IACrC;;;OAGG;IACH,gBAAgB,EAAE,0BAA0B,EAAE,CAG7C;IACD;;;OAGG;IACH,QAAQ,EAAE,sBAAsB,EAAE,CAIjC;IAED;;;OAGG;IACH,UAAU,EAAE,CAAC,UAAU,aAAa,CAAC,EAAE,CAAK;IAE5C;;;OAGG;IACH,MAAM,EAAE,CAAC,UAAU,KAAK,CAAC,EAAE,CAAK;IAEhC;;;OAGG;IACH,SAAS;IA4BT;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,IAAI,sCAAsC,CAAC,SAAS,CAAC;CAC9E"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ApplicationCommandType } from "discord-api-types/v10";
|
|
2
|
+
import { ApplicationIntegrationType, InteractionContextType } from "../index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Represents the base data of a command that the user creates
|
|
5
|
+
*/
|
|
6
|
+
export class BaseCommand {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the command response should be automatically deferred
|
|
9
|
+
*/
|
|
10
|
+
defer = false;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the command response should be ephemeral
|
|
13
|
+
*/
|
|
14
|
+
ephemeral = false;
|
|
15
|
+
/**
|
|
16
|
+
* The places this command can be used in
|
|
17
|
+
* @beta API types are not finalized
|
|
18
|
+
*/
|
|
19
|
+
integrationTypes = [
|
|
20
|
+
ApplicationIntegrationType.GuildInstall,
|
|
21
|
+
ApplicationIntegrationType.UserInstall
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* The contexts this command can be used in
|
|
25
|
+
* @beta API types are not finalized
|
|
26
|
+
*/
|
|
27
|
+
contexts = [
|
|
28
|
+
InteractionContextType.Guild,
|
|
29
|
+
InteractionContextType.BotDM,
|
|
30
|
+
InteractionContextType.PrivateChannel
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* The components that the command is able to use.
|
|
34
|
+
* You pass these here so the handler can listen for them..
|
|
35
|
+
*/
|
|
36
|
+
components = [];
|
|
37
|
+
/**
|
|
38
|
+
* All the modals that the command is able to use.
|
|
39
|
+
* You pass these here so the handler can listen for them.
|
|
40
|
+
*/
|
|
41
|
+
modals = [];
|
|
42
|
+
/**
|
|
43
|
+
* Serializes the command into a JSON object that can be sent to Discord
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
serialize() {
|
|
47
|
+
if (this.type === ApplicationCommandType.PrimaryEntryPoint) {
|
|
48
|
+
throw new Error("Primary Entry Point commands cannot be serialized");
|
|
49
|
+
}
|
|
50
|
+
// Only chat input commands can have descriptions
|
|
51
|
+
if (this.type === ApplicationCommandType.ChatInput) {
|
|
52
|
+
const data = {
|
|
53
|
+
name: this.name,
|
|
54
|
+
type: this.type,
|
|
55
|
+
description: this.description,
|
|
56
|
+
options: this.serializeOptions(),
|
|
57
|
+
integration_types: this.integrationTypes,
|
|
58
|
+
contexts: this.contexts
|
|
59
|
+
};
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
62
|
+
const data = {
|
|
63
|
+
name: this.name,
|
|
64
|
+
type: this.type,
|
|
65
|
+
options: this.serializeOptions(),
|
|
66
|
+
integration_types: this.integrationTypes,
|
|
67
|
+
contexts: this.contexts
|
|
68
|
+
};
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=BaseCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseCommand.js","sourceRoot":"","sources":["../../../src/abstracts/BaseCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EAEtB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACN,0BAA0B,EAE1B,sBAAsB,EAEtB,MAAM,aAAa,CAAA;AAEpB;;GAEG;AACH,MAAM,OAAgB,WAAW;IAShC;;OAEG;IACH,KAAK,GAAG,KAAK,CAAA;IACb;;OAEG;IACH,SAAS,GAAG,KAAK,CAAA;IAKjB;;;OAGG;IACH,gBAAgB,GAAiC;QAChD,0BAA0B,CAAC,YAAY;QACvC,0BAA0B,CAAC,WAAW;KACtC,CAAA;IACD;;;OAGG;IACH,QAAQ,GAA6B;QACpC,sBAAsB,CAAC,KAAK;QAC5B,sBAAsB,CAAC,KAAK;QAC5B,sBAAsB,CAAC,cAAc;KACrC,CAAA;IAED;;;OAGG;IACH,UAAU,GAAgC,EAAE,CAAA;IAE5C;;;OAGG;IACH,MAAM,GAAwB,EAAE,CAAA;IAEhC;;;OAGG;IACH,SAAS;QACR,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAsB,CAAC,iBAAiB,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;QACrE,CAAC;QACD,iDAAiD;QACjD,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAsB,CAAC,SAAS,EAAE,CAAC;YACpD,MAAM,IAAI,GAA2C;gBACpD,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE;gBAChC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;gBACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACvB,CAAA;YAED,OAAO,IAAI,CAAA;QACZ,CAAC;QACD,MAAM,IAAI,GAA2C;YACpD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE;YAChC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;YACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAA;QAED,OAAO,IAAI,CAAA;IACZ,CAAC;CAOD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { APIBaseComponent, ComponentType } from "discord-api-types/v10";
|
|
2
|
+
export type ComponentAdditionalData = {
|
|
3
|
+
[key: string]: string | number | boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare abstract class BaseComponent {
|
|
6
|
+
constructor(data?: {
|
|
7
|
+
additionalData?: ComponentAdditionalData;
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Whether the component response should be automatically deferred
|
|
11
|
+
*/
|
|
12
|
+
defer: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the component response should be ephemeral
|
|
15
|
+
*/
|
|
16
|
+
ephemeral: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The type of the component
|
|
19
|
+
*/
|
|
20
|
+
abstract type: ComponentType;
|
|
21
|
+
/**
|
|
22
|
+
* The custom ID of the component
|
|
23
|
+
*/
|
|
24
|
+
abstract customId: string;
|
|
25
|
+
additionalData: ComponentAdditionalData | null;
|
|
26
|
+
/**
|
|
27
|
+
* Create a custom ID to use for this component that embeds additional data that you want to be handed
|
|
28
|
+
* @param additionalData The additional data that you want to be passed in this component's custom ID
|
|
29
|
+
* @returns The custom ID to use
|
|
30
|
+
*/
|
|
31
|
+
createId: (additionalData: typeof this.additionalData) => string;
|
|
32
|
+
abstract serialize: () => APIBaseComponent<typeof this.type>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=BaseComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseComponent.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE5E,MAAM,MAAM,uBAAuB,GAAG;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;CACxC,CAAA;AAED,8BAAsB,aAAa;gBACtB,IAAI,CAAC,EAAE;QAClB,cAAc,CAAC,EAAE,uBAAuB,CAAA;KACxC;IAID;;OAEG;IACH,KAAK,UAAQ;IACb;;OAEG;IACH,SAAS,UAAQ;IAEjB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;IAC5B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB,cAAc,EAAE,uBAAuB,GAAG,IAAI,CAAO;IAErD;;;;OAIG;IACI,QAAQ,mBAAoB,OAAO,IAAI,CAAC,cAAc,YAO5D;IAED,QAAQ,CAAC,SAAS,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAA;CAC5D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class BaseComponent {
|
|
2
|
+
constructor(data) {
|
|
3
|
+
if (data?.additionalData)
|
|
4
|
+
this.additionalData = data.additionalData;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Whether the component response should be automatically deferred
|
|
8
|
+
*/
|
|
9
|
+
defer = false;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the component response should be ephemeral
|
|
12
|
+
*/
|
|
13
|
+
ephemeral = false;
|
|
14
|
+
additionalData = null;
|
|
15
|
+
/**
|
|
16
|
+
* Create a custom ID to use for this component that embeds additional data that you want to be handed
|
|
17
|
+
* @param additionalData The additional data that you want to be passed in this component's custom ID
|
|
18
|
+
* @returns The custom ID to use
|
|
19
|
+
*/
|
|
20
|
+
createId = (additionalData) => {
|
|
21
|
+
if (!additionalData)
|
|
22
|
+
return this.customId;
|
|
23
|
+
// id:arg1=1;arg2=2
|
|
24
|
+
const id = `${this.customId}:${Object.entries(additionalData)
|
|
25
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
26
|
+
.join(";")}`;
|
|
27
|
+
return id;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=BaseComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseComponent.js","sourceRoot":"","sources":["../../../src/abstracts/BaseComponent.ts"],"names":[],"mappings":"AAMA,MAAM,OAAgB,aAAa;IAClC,YAAY,IAEX;QACA,IAAI,IAAI,EAAE,cAAc;YAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;IACpE,CAAC;IAED;;OAEG;IACH,KAAK,GAAG,KAAK,CAAA;IACb;;OAEG;IACH,SAAS,GAAG,KAAK,CAAA;IAWjB,cAAc,GAAmC,IAAI,CAAA;IAErD;;;;OAIG;IACI,QAAQ,GAAG,CAAC,cAA0C,EAAE,EAAE;QAChE,IAAI,CAAC,cAAc;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAA;QACzC,mBAAmB;QACnB,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;aAC3D,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;aACxC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;QACb,OAAO,EAAE,CAAA;IACV,CAAC,CAAA;CAGD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type APIMessageComponentInteraction, type ComponentType } from "discord-api-types/v10";
|
|
2
|
+
import type { Client } from "../classes/Client.js";
|
|
3
|
+
import type { MessagePayload } from "../types.js";
|
|
4
|
+
import { BaseInteraction, type InteractionDefaults, type InteractionReplyOptions } from "./BaseInteraction.js";
|
|
5
|
+
export declare class BaseComponentInteraction extends BaseInteraction<APIMessageComponentInteraction> {
|
|
6
|
+
customId: string;
|
|
7
|
+
componentType: ComponentType;
|
|
8
|
+
constructor(client: Client, data: APIMessageComponentInteraction, defaults: InteractionDefaults);
|
|
9
|
+
/**
|
|
10
|
+
* Acknowledge the interaction, the user does not see a loading state.
|
|
11
|
+
* This can only be used for component interactions
|
|
12
|
+
*/
|
|
13
|
+
acknowledge(): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Update the original message of the component
|
|
16
|
+
*/
|
|
17
|
+
update(data: MessagePayload, options?: Pick<InteractionReplyOptions, "files">): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=BaseComponentInteraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseComponentInteraction.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseComponentInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,8BAA8B,EACnC,KAAK,aAAa,EAIlB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,EACN,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,MAAM,sBAAsB,CAAA;AAE7B,qBAAa,wBAAyB,SAAQ,eAAe,CAAC,8BAA8B,CAAC;IAC5F,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,aAAa,CAAA;gBAE3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,8BAA8B,EACpC,QAAQ,EAAE,mBAAmB;IAS9B;;;OAGG;IACG,WAAW;IAYjB;;OAEG;IACG,MAAM,CACX,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAM;CAgBrD"}
|