@buape/carbon 0.4.1 → 0.5.0
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 +26 -19
- package/dist/package.json +1 -1
- package/dist/src/abstracts/BaseChannel.d.ts +22 -21
- package/dist/src/abstracts/BaseChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseChannel.js +37 -27
- package/dist/src/abstracts/BaseChannel.js.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.d.ts +3 -2
- package/dist/src/abstracts/BaseComponentInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseComponentInteraction.js +3 -4
- package/dist/src/abstracts/BaseComponentInteraction.js.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.d.ts +12 -10
- package/dist/src/abstracts/BaseGuildChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseGuildChannel.js +35 -22
- package/dist/src/abstracts/BaseGuildChannel.js.map +1 -1
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts +13 -9
- package/dist/src/abstracts/BaseGuildTextChannel.d.ts.map +1 -1
- package/dist/src/abstracts/BaseGuildTextChannel.js +25 -9
- package/dist/src/abstracts/BaseGuildTextChannel.js.map +1 -1
- package/dist/src/abstracts/BaseInteraction.d.ts +7 -23
- package/dist/src/abstracts/BaseInteraction.d.ts.map +1 -1
- package/dist/src/abstracts/BaseInteraction.js +12 -12
- package/dist/src/abstracts/BaseInteraction.js.map +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts +14 -13
- package/dist/src/abstracts/GuildThreadOnlyChannel.d.ts.map +1 -1
- package/dist/src/abstracts/GuildThreadOnlyChannel.js +31 -16
- package/dist/src/abstracts/GuildThreadOnlyChannel.js.map +1 -1
- package/dist/src/classes/Button.d.ts +0 -4
- package/dist/src/classes/Button.d.ts.map +1 -1
- package/dist/src/classes/Button.js +6 -0
- package/dist/src/classes/Button.js.map +1 -1
- package/dist/src/classes/Client.d.ts +35 -0
- package/dist/src/classes/Client.d.ts.map +1 -1
- package/dist/src/classes/Client.js +52 -0
- package/dist/src/classes/Client.js.map +1 -1
- package/dist/src/factories/channelFactory.d.ts +1 -1
- package/dist/src/factories/channelFactory.d.ts.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.d.ts +2 -3
- package/dist/src/internals/AutocompleteInteraction.d.ts.map +1 -1
- package/dist/src/internals/AutocompleteInteraction.js +2 -8
- package/dist/src/internals/AutocompleteInteraction.js.map +1 -1
- package/dist/src/internals/CommandHandler.d.ts.map +1 -1
- package/dist/src/internals/CommandHandler.js +4 -2
- package/dist/src/internals/CommandHandler.js.map +1 -1
- package/dist/src/internals/CommandInteraction.d.ts +3 -4
- package/dist/src/internals/CommandInteraction.d.ts.map +1 -1
- package/dist/src/internals/CommandInteraction.js +6 -12
- package/dist/src/internals/CommandInteraction.js.map +1 -1
- package/dist/src/internals/ModalInteraction.d.ts +3 -2
- package/dist/src/internals/ModalInteraction.d.ts.map +1 -1
- package/dist/src/internals/ModalInteraction.js +3 -3
- package/dist/src/internals/ModalInteraction.js.map +1 -1
- package/dist/src/internals/OptionsHandler.d.ts +8 -12
- package/dist/src/internals/OptionsHandler.d.ts.map +1 -1
- package/dist/src/internals/OptionsHandler.js +27 -9
- package/dist/src/internals/OptionsHandler.js.map +1 -1
- package/dist/src/structures/DmChannel.d.ts +7 -6
- package/dist/src/structures/DmChannel.d.ts.map +1 -1
- package/dist/src/structures/DmChannel.js +7 -6
- package/dist/src/structures/DmChannel.js.map +1 -1
- package/dist/src/structures/GroupDmChannel.d.ts +17 -19
- package/dist/src/structures/GroupDmChannel.d.ts.map +1 -1
- package/dist/src/structures/GroupDmChannel.js +48 -41
- package/dist/src/structures/GroupDmChannel.js.map +1 -1
- package/dist/src/structures/Guild.d.ts +29 -28
- package/dist/src/structures/Guild.d.ts.map +1 -1
- package/dist/src/structures/Guild.js +82 -57
- package/dist/src/structures/Guild.js.map +1 -1
- package/dist/src/structures/GuildAnnouncementChannel.d.ts +3 -4
- package/dist/src/structures/GuildAnnouncementChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildAnnouncementChannel.js +1 -3
- package/dist/src/structures/GuildAnnouncementChannel.js.map +1 -1
- package/dist/src/structures/GuildCategoryChannel.d.ts +3 -3
- package/dist/src/structures/GuildCategoryChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildCategoryChannel.js +0 -1
- package/dist/src/structures/GuildCategoryChannel.js.map +1 -1
- package/dist/src/structures/GuildForumChannel.d.ts +4 -3
- package/dist/src/structures/GuildForumChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildForumChannel.js +4 -3
- package/dist/src/structures/GuildForumChannel.js.map +1 -1
- package/dist/src/structures/GuildMediaChannel.d.ts +3 -7
- package/dist/src/structures/GuildMediaChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildMediaChannel.js +1 -6
- package/dist/src/structures/GuildMediaChannel.js.map +1 -1
- package/dist/src/structures/GuildMember.d.ts +28 -26
- package/dist/src/structures/GuildMember.d.ts.map +1 -1
- package/dist/src/structures/GuildMember.js +95 -57
- package/dist/src/structures/GuildMember.js.map +1 -1
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts +12 -11
- package/dist/src/structures/GuildStageOrVoiceChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildStageOrVoiceChannel.js +22 -13
- package/dist/src/structures/GuildStageOrVoiceChannel.js.map +1 -1
- package/dist/src/structures/GuildTextChannel.d.ts +6 -6
- package/dist/src/structures/GuildTextChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildTextChannel.js +9 -7
- package/dist/src/structures/GuildTextChannel.js.map +1 -1
- package/dist/src/structures/GuildThreadChannel.d.ts +14 -13
- package/dist/src/structures/GuildThreadChannel.d.ts.map +1 -1
- package/dist/src/structures/GuildThreadChannel.js +59 -28
- package/dist/src/structures/GuildThreadChannel.js.map +1 -1
- package/dist/src/structures/Message.d.ts +52 -43
- package/dist/src/structures/Message.d.ts.map +1 -1
- package/dist/src/structures/Message.js +165 -95
- package/dist/src/structures/Message.js.map +1 -1
- package/dist/src/structures/Role.d.ts +27 -25
- package/dist/src/structures/Role.d.ts.map +1 -1
- package/dist/src/structures/Role.js +100 -61
- package/dist/src/structures/Role.js.map +1 -1
- package/dist/src/structures/User.d.ts +34 -32
- package/dist/src/structures/User.d.ts.map +1 -1
- package/dist/src/structures/User.js +97 -64
- package/dist/src/structures/User.js.map +1 -1
- 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 +16 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +9 -0
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,45 +1,52 @@
|
|
|
1
1
|
# Carbon
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
|
-
<a href="https://go.buape.com/
|
|
4
|
+
<a href="https://go.buape.com/carbon"><img src="https://cdn.buape.com/CarbonWordmark.png" alt="Carbon Wordmark"></a>
|
|
5
5
|
|
|
6
|
-
<img alt="Discord" src="https://img.shields.io/discord/
|
|
6
|
+
<img alt="Discord" src="https://img.shields.io/discord/1280628625904894072?style=for-the-badge">
|
|
7
7
|
<img alt="NPM Version" src="https://img.shields.io/npm/v/@buape/carbon?style=for-the-badge">
|
|
8
8
|
<img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@buape/carbon?style=for-the-badge">
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
Carbon is a fully-featured framework for building HTTP Discord bots
|
|
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
12
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
15
15
|
- Fully up to date with the Discord API
|
|
16
|
-
-
|
|
17
|
-
- Easy to use
|
|
18
|
-
- Built in pagination support
|
|
19
|
-
-
|
|
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
20
|
|
|
21
21
|
## Why Carbon?
|
|
22
22
|
|
|
23
23
|
Carbon is designed to be easy to use and understand, while still providing the flexibility and power needed to build complex bots.
|
|
24
|
-
|
|
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
25
|
|
|
26
26
|
## Installation
|
|
27
27
|
|
|
28
|
-
To get started with Carbon, you can
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install @buape/carbon
|
|
32
|
-
```
|
|
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.
|
|
33
29
|
|
|
34
30
|
## Useful Links
|
|
35
31
|
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
38
|
-
- [Discord](https://go.buape.com/discord)
|
|
32
|
+
- [Documentation](https://carbon.buape.com/carbon)
|
|
33
|
+
- [Discord](https://go.buape.com/carbon)
|
|
39
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 -->
|
|
40
47
|
|
|
41
48
|
|
|
42
|
-
|
|
49
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
43
50
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
51
|
+
<!-- markdownlint-restore -->
|
|
52
|
+
<!-- prettier-ignore-end -->
|
package/dist/package.json
CHANGED
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { type APIChannel, type ChannelType } from "discord-api-types/v10";
|
|
1
|
+
import { type APIChannel, type ChannelFlags, type ChannelType } from "discord-api-types/v10";
|
|
2
2
|
import type { Client } from "../classes/Client.js";
|
|
3
|
+
import type { IfPartial } from "../utils.js";
|
|
3
4
|
import { Base } from "./Base.js";
|
|
4
|
-
export declare abstract class BaseChannel<Type extends ChannelType> extends Base {
|
|
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;
|
|
5
21
|
/**
|
|
6
22
|
* The id of the channel.
|
|
7
23
|
*/
|
|
8
|
-
id: string;
|
|
24
|
+
readonly id: string;
|
|
9
25
|
/**
|
|
10
26
|
* Whether the channel is a partial channel (meaning it does not have all the data).
|
|
11
27
|
* If this is true, you should use {@link BaseChannel.fetch} to get the full data of the channel.
|
|
12
28
|
*/
|
|
13
|
-
partial:
|
|
29
|
+
get partial(): IsPartial;
|
|
14
30
|
/**
|
|
15
31
|
* The type of the channel.
|
|
16
32
|
*/
|
|
17
|
-
type
|
|
33
|
+
get type(): IfPartial<IsPartial, Type>;
|
|
18
34
|
/**
|
|
19
35
|
* The flags of the channel in a bitfield.
|
|
20
36
|
* @see https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
|
21
37
|
*/
|
|
22
|
-
flags
|
|
23
|
-
/**
|
|
24
|
-
* The raw data of the channel.
|
|
25
|
-
*/
|
|
26
|
-
protected rawData: Extract<APIChannel, {
|
|
27
|
-
type: Type;
|
|
28
|
-
}> | null;
|
|
29
|
-
constructor(client: Client, rawDataOrId: Extract<APIChannel, {
|
|
30
|
-
type: Type;
|
|
31
|
-
}> | string);
|
|
32
|
-
protected setData(data: Extract<APIChannel, {
|
|
33
|
-
type: Type;
|
|
34
|
-
}>): void;
|
|
35
|
-
protected abstract setSpecificData(data: Extract<APIChannel, {
|
|
36
|
-
type: Type;
|
|
37
|
-
}>): void;
|
|
38
|
+
get flags(): IfPartial<IsPartial, ChannelFlags | undefined>;
|
|
38
39
|
/**
|
|
39
40
|
* Fetches the channel from the API.
|
|
40
41
|
* @returns The channel data.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,WAAW,EAEhB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,8BAAsB,WAAW,
|
|
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"}
|
|
@@ -1,48 +1,58 @@
|
|
|
1
1
|
import { Routes } from "discord-api-types/v10";
|
|
2
2
|
import { Base } from "./Base.js";
|
|
3
3
|
export class BaseChannel extends Base {
|
|
4
|
-
/**
|
|
5
|
-
* The id of the channel.
|
|
6
|
-
*/
|
|
7
|
-
id;
|
|
8
|
-
/**
|
|
9
|
-
* Whether the channel is a partial channel (meaning it does not have all the data).
|
|
10
|
-
* If this is true, you should use {@link BaseChannel.fetch} to get the full data of the channel.
|
|
11
|
-
*/
|
|
12
|
-
partial;
|
|
13
|
-
/**
|
|
14
|
-
* The type of the channel.
|
|
15
|
-
*/
|
|
16
|
-
type;
|
|
17
|
-
/**
|
|
18
|
-
* The flags of the channel in a bitfield.
|
|
19
|
-
* @see https://discord.com/developers/docs/resources/channel#channel-object-channel-flags
|
|
20
|
-
*/
|
|
21
|
-
flags;
|
|
22
|
-
/**
|
|
23
|
-
* The raw data of the channel.
|
|
24
|
-
*/
|
|
25
|
-
rawData = null;
|
|
26
4
|
constructor(client, rawDataOrId) {
|
|
27
5
|
super(client);
|
|
28
6
|
if (typeof rawDataOrId === "string") {
|
|
29
7
|
this.id = rawDataOrId;
|
|
30
|
-
this.partial = true;
|
|
31
8
|
}
|
|
32
9
|
else {
|
|
33
10
|
this.rawData = rawDataOrId;
|
|
34
11
|
this.id = rawDataOrId.id;
|
|
35
|
-
this.partial = false;
|
|
36
12
|
this.setData(rawDataOrId);
|
|
37
13
|
}
|
|
38
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The raw data of the channel.
|
|
17
|
+
*/
|
|
18
|
+
rawData = null;
|
|
39
19
|
setData(data) {
|
|
40
20
|
if (!data)
|
|
41
21
|
throw new Error("Cannot set data without having data... smh");
|
|
42
22
|
this.rawData = data;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.
|
|
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;
|
|
46
56
|
}
|
|
47
57
|
/**
|
|
48
58
|
* Fetches the channel from the API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseChannel.js","sourceRoot":"","sources":["../../../src/abstracts/BaseChannel.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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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import type { Client } from "../classes/Client.js";
|
|
3
|
-
import
|
|
3
|
+
import type { MessagePayload } from "../types.js";
|
|
4
|
+
import { BaseInteraction, type InteractionDefaults, type InteractionReplyOptions } from "./BaseInteraction.js";
|
|
4
5
|
export declare class BaseComponentInteraction extends BaseInteraction<APIMessageComponentInteraction> {
|
|
5
6
|
customId: string;
|
|
6
7
|
componentType: ComponentType;
|
|
@@ -13,6 +14,6 @@ export declare class BaseComponentInteraction extends BaseInteraction<APIMessage
|
|
|
13
14
|
/**
|
|
14
15
|
* Update the original message of the component
|
|
15
16
|
*/
|
|
16
|
-
update(data:
|
|
17
|
+
update(data: MessagePayload, options?: Pick<InteractionReplyOptions, "files">): Promise<void>;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=BaseComponentInteraction.d.ts.map
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InteractionResponseType, Routes } from "discord-api-types/v10";
|
|
2
|
-
import { splitCustomId } from "../utils.js";
|
|
2
|
+
import { serializePayload, splitCustomId } from "../utils.js";
|
|
3
3
|
import { BaseInteraction } from "./BaseInteraction.js";
|
|
4
4
|
export class BaseComponentInteraction extends BaseInteraction {
|
|
5
5
|
customId;
|
|
@@ -27,13 +27,12 @@ export class BaseComponentInteraction extends BaseInteraction {
|
|
|
27
27
|
* Update the original message of the component
|
|
28
28
|
*/
|
|
29
29
|
async update(data, options = {}) {
|
|
30
|
+
const serialized = serializePayload(data);
|
|
30
31
|
await this.client.rest.post(Routes.interactionCallback(this.rawData.id, this.rawData.token), {
|
|
31
32
|
body: {
|
|
32
33
|
type: InteractionResponseType.UpdateMessage,
|
|
33
34
|
data: {
|
|
34
|
-
...
|
|
35
|
-
embeds: data.embeds?.map((embed) => embed.serialize()),
|
|
36
|
-
components: data.components?.map((row) => row.serialize())
|
|
35
|
+
...serialized
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
files: options.files
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseComponentInteraction.js","sourceRoot":"","sources":["../../../src/abstracts/BaseComponentInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,uBAAuB,EAEvB,MAAM,EACN,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"BaseComponentInteraction.js","sourceRoot":"","sources":["../../../src/abstracts/BaseComponentInteraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAG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AAK,CAAC,EAC/D;YACC,IAAI,EAAE;gBACL,IAAI,EAAE,uBAAuB,CAAC,aAAa;gBAC3C,IAAI,EAAE;oBACL,GAAG,UAAU;iBACb;aACyC;YAC3C,KAAK,EAAE,OAAO,CAAC,KAAK;SACpB,CACD,CAAA;IACF,CAAC;CACD"}
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { type APIGuildChannel, type
|
|
1
|
+
import { type APIGuildChannel, type GuildChannelType, type RESTGetAPIGuildInvitesResult, type RESTPostAPIChannelInviteJSONBody } from "discord-api-types/v10";
|
|
2
2
|
import { Guild } from "../structures/Guild.js";
|
|
3
3
|
import type { GuildCategoryChannel } from "../structures/GuildCategoryChannel.js";
|
|
4
|
+
import type { MessagePayload } from "../types.js";
|
|
5
|
+
import type { IfPartial } from "../utils.js";
|
|
4
6
|
import { BaseChannel } from "./BaseChannel.js";
|
|
5
|
-
export declare abstract class BaseGuildChannel<Type extends GuildChannelType> extends BaseChannel<Type> {
|
|
7
|
+
export declare abstract class BaseGuildChannel<Type extends GuildChannelType, IsPartial extends boolean = false> extends BaseChannel<Type, IsPartial> {
|
|
8
|
+
rawData: APIGuildChannel<Type> | null;
|
|
6
9
|
/**
|
|
7
10
|
* The name of the channel.
|
|
8
11
|
*/
|
|
9
|
-
name
|
|
12
|
+
get name(): IfPartial<IsPartial, string>;
|
|
10
13
|
/**
|
|
11
14
|
* The ID of the guild this channel is in
|
|
12
15
|
*/
|
|
13
|
-
guildId
|
|
16
|
+
get guildId(): IfPartial<IsPartial, string>;
|
|
14
17
|
/**
|
|
15
18
|
* The position of the channel in the channel list.
|
|
16
19
|
*/
|
|
17
|
-
position
|
|
20
|
+
get position(): IfPartial<IsPartial, number>;
|
|
18
21
|
/**
|
|
19
22
|
* The ID of the parent category for the channel.
|
|
20
23
|
*/
|
|
21
|
-
parentId
|
|
24
|
+
get parentId(): IfPartial<IsPartial, string | null>;
|
|
22
25
|
/**
|
|
23
26
|
* Whether the channel is marked as nsfw.
|
|
24
27
|
*/
|
|
25
|
-
nsfw
|
|
28
|
+
get nsfw(): IfPartial<IsPartial, boolean>;
|
|
26
29
|
/**
|
|
27
30
|
* The guild this channel is in
|
|
28
31
|
*/
|
|
29
|
-
get guild(): Guild
|
|
30
|
-
protected setData(data: APIGuildChannel<Type>): void;
|
|
32
|
+
get guild(): IfPartial<IsPartial, Guild<true>>;
|
|
31
33
|
/**
|
|
32
34
|
* Set the name of the channel
|
|
33
35
|
* @param name The new name of the channel
|
|
@@ -51,7 +53,7 @@ export declare abstract class BaseGuildChannel<Type extends GuildChannelType> ex
|
|
|
51
53
|
/**
|
|
52
54
|
* Send a message to the channel
|
|
53
55
|
*/
|
|
54
|
-
send(message:
|
|
56
|
+
send(message: MessagePayload): Promise<void>;
|
|
55
57
|
/**
|
|
56
58
|
* Get the invites for the channel
|
|
57
59
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseGuildChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseGuildChannel.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseGuildChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseGuildChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,4BAA4B,EACjC,KAAK,gCAAgC,EAGrC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,8BAAsB,gBAAgB,CACrC,IAAI,SAAS,gBAAgB,EAC7B,SAAS,SAAS,OAAO,GAAG,KAAK,CAChC,SAAQ,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC;IAE7B,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAE7C;;OAEG;IACH,IAAI,IAAI,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,CAGvC;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,CAG1C;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,CAG3C;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,CAGlD;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAGxC;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAI7C;IAED;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM;IAS1B;;;OAGG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM;IASlC;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM;IAkBrD;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE,OAAO;IAS3B;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc;IAMlC;;OAEG;IACG,UAAU;IAMhB;;OAEG;IACG,YAAY,CAAC,OAAO,CAAC,EAAE,gCAAgC;IAM7D;;OAEG;IACG,aAAa;CAGnB"}
|
|
@@ -1,45 +1,58 @@
|
|
|
1
1
|
import { Routes } from "discord-api-types/v10";
|
|
2
2
|
import { Guild } from "../structures/Guild.js";
|
|
3
|
+
import { serializePayload } from "../utils.js";
|
|
3
4
|
import { BaseChannel } from "./BaseChannel.js";
|
|
4
5
|
export class BaseGuildChannel extends BaseChannel {
|
|
5
6
|
/**
|
|
6
7
|
* The name of the channel.
|
|
7
8
|
*/
|
|
8
|
-
name
|
|
9
|
+
get name() {
|
|
10
|
+
if (!this.rawData)
|
|
11
|
+
return undefined;
|
|
12
|
+
return this.rawData.name;
|
|
13
|
+
}
|
|
9
14
|
/**
|
|
10
15
|
* The ID of the guild this channel is in
|
|
11
16
|
*/
|
|
12
|
-
guildId
|
|
17
|
+
get guildId() {
|
|
18
|
+
if (!this.rawData)
|
|
19
|
+
return undefined;
|
|
20
|
+
return this.rawData.guild_id;
|
|
21
|
+
}
|
|
13
22
|
/**
|
|
14
23
|
* The position of the channel in the channel list.
|
|
15
24
|
*/
|
|
16
|
-
position
|
|
25
|
+
get position() {
|
|
26
|
+
if (!this.rawData)
|
|
27
|
+
return undefined;
|
|
28
|
+
return this.rawData.position;
|
|
29
|
+
}
|
|
17
30
|
/**
|
|
18
31
|
* The ID of the parent category for the channel.
|
|
19
32
|
*/
|
|
20
|
-
parentId
|
|
33
|
+
get parentId() {
|
|
34
|
+
if (!this.rawData)
|
|
35
|
+
return undefined;
|
|
36
|
+
return this.rawData.parent_id ?? null;
|
|
37
|
+
}
|
|
21
38
|
/**
|
|
22
39
|
* Whether the channel is marked as nsfw.
|
|
23
40
|
*/
|
|
24
|
-
nsfw
|
|
41
|
+
get nsfw() {
|
|
42
|
+
if (!this.rawData)
|
|
43
|
+
return undefined;
|
|
44
|
+
return this.rawData.nsfw ?? false;
|
|
45
|
+
}
|
|
25
46
|
/**
|
|
26
47
|
* The guild this channel is in
|
|
27
48
|
*/
|
|
28
49
|
get guild() {
|
|
50
|
+
if (!this.rawData)
|
|
51
|
+
return undefined;
|
|
29
52
|
if (!this.guildId)
|
|
30
53
|
throw new Error("Cannot get guild without guild ID");
|
|
31
54
|
return new Guild(this.client, this.guildId);
|
|
32
55
|
}
|
|
33
|
-
setData(data) {
|
|
34
|
-
this.rawData = data;
|
|
35
|
-
this.partial = false;
|
|
36
|
-
this.name = data.name;
|
|
37
|
-
this.guildId = data.guild_id;
|
|
38
|
-
this.position = data.position;
|
|
39
|
-
this.parentId = data.parent_id;
|
|
40
|
-
this.nsfw = data.nsfw;
|
|
41
|
-
this.setSpecificData(data);
|
|
42
|
-
}
|
|
43
56
|
/**
|
|
44
57
|
* Set the name of the channel
|
|
45
58
|
* @param name The new name of the channel
|
|
@@ -50,7 +63,7 @@ export class BaseGuildChannel extends BaseChannel {
|
|
|
50
63
|
name
|
|
51
64
|
}
|
|
52
65
|
});
|
|
53
|
-
this.name
|
|
66
|
+
this.setField("name", name);
|
|
54
67
|
}
|
|
55
68
|
/**
|
|
56
69
|
* Set the position of the channel
|
|
@@ -62,7 +75,7 @@ export class BaseGuildChannel extends BaseChannel {
|
|
|
62
75
|
position
|
|
63
76
|
}
|
|
64
77
|
});
|
|
65
|
-
this.position
|
|
78
|
+
this.setField("position", position);
|
|
66
79
|
}
|
|
67
80
|
/**
|
|
68
81
|
* Set the parent ID of the channel
|
|
@@ -75,7 +88,7 @@ export class BaseGuildChannel extends BaseChannel {
|
|
|
75
88
|
parent_id: parent
|
|
76
89
|
}
|
|
77
90
|
});
|
|
78
|
-
this.
|
|
91
|
+
this.setField("parent_id", parent);
|
|
79
92
|
}
|
|
80
93
|
else {
|
|
81
94
|
await this.client.rest.patch(Routes.channel(this.id), {
|
|
@@ -83,7 +96,7 @@ export class BaseGuildChannel extends BaseChannel {
|
|
|
83
96
|
parent_id: parent.id
|
|
84
97
|
}
|
|
85
98
|
});
|
|
86
|
-
this.
|
|
99
|
+
this.setField("parent_id", parent.id);
|
|
87
100
|
}
|
|
88
101
|
}
|
|
89
102
|
/**
|
|
@@ -96,14 +109,14 @@ export class BaseGuildChannel extends BaseChannel {
|
|
|
96
109
|
nsfw
|
|
97
110
|
}
|
|
98
111
|
});
|
|
99
|
-
this.nsfw
|
|
112
|
+
this.setField("nsfw", nsfw);
|
|
100
113
|
}
|
|
101
114
|
/**
|
|
102
115
|
* Send a message to the channel
|
|
103
116
|
*/
|
|
104
117
|
async send(message) {
|
|
105
118
|
this.client.rest.post(Routes.channelMessages(this.id), {
|
|
106
|
-
body:
|
|
119
|
+
body: serializePayload(message)
|
|
107
120
|
});
|
|
108
121
|
}
|
|
109
122
|
/**
|
|
@@ -124,7 +137,7 @@ export class BaseGuildChannel extends BaseChannel {
|
|
|
124
137
|
* Trigger a typing indicator in the channel (this will expire after 10 seconds)
|
|
125
138
|
*/
|
|
126
139
|
async triggerTyping() {
|
|
127
|
-
await this.client.rest.post(Routes.channelTyping(this.id));
|
|
140
|
+
await this.client.rest.post(Routes.channelTyping(this.id), {});
|
|
128
141
|
}
|
|
129
142
|
}
|
|
130
143
|
//# sourceMappingURL=BaseGuildChannel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseGuildChannel.js","sourceRoot":"","sources":["../../../src/abstracts/BaseGuildChannel.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseGuildChannel.js","sourceRoot":"","sources":["../../../src/abstracts/BaseGuildChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,MAAM,EACN,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAI9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,OAAgB,gBAGpB,SAAQ,WAA4B;IAIrC;;OAEG;IACH,IAAI,IAAI;QACP,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAa,CAAA;IAClC,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACV,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAkB,CAAA;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,QAAiB,CAAA;IACtC,CAAC;IAED;;OAEG;IACH,IAAI,QAAQ;QACX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,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACf,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CACjC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAC9B,CAAiC,CAAA;IACnC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,OAA0C;QAC5D,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YACnE,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE;SACpB,CAAC,CAAmC,CAAA;IACtC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa;QAClB,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;IAC/D,CAAC;CACD"}
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import { type APIGuildTextChannel, type GuildTextChannelType, type RESTPostAPIChannelThreadsJSONBody } from "discord-api-types/v10";
|
|
2
2
|
import { GuildThreadChannel } from "../structures/GuildThreadChannel.js";
|
|
3
3
|
import { Message } from "../structures/Message.js";
|
|
4
|
+
import type { IfPartial } from "../utils.js";
|
|
4
5
|
import { BaseGuildChannel } from "./BaseGuildChannel.js";
|
|
5
|
-
export declare abstract class BaseGuildTextChannel<Type extends GuildTextChannelType> extends BaseGuildChannel<Type> {
|
|
6
|
+
export declare abstract class BaseGuildTextChannel<Type extends GuildTextChannelType, IsPartial extends boolean = false> extends BaseGuildChannel<Type, IsPartial> {
|
|
7
|
+
rawData: APIGuildTextChannel<Type> | null;
|
|
8
|
+
/**
|
|
9
|
+
* The topic of the channel.
|
|
10
|
+
*/
|
|
11
|
+
get topic(): IfPartial<IsPartial, string | null>;
|
|
6
12
|
/**
|
|
7
13
|
* The ID of the last message sent in the channel.
|
|
8
14
|
*
|
|
9
15
|
* @remarks
|
|
10
16
|
* This might not always resolve to a message. The ID still stays a part of the channel's data, even if the message is deleted.
|
|
11
17
|
*/
|
|
12
|
-
lastMessageId
|
|
18
|
+
get lastMessageId(): IfPartial<IsPartial, string | null>;
|
|
13
19
|
/**
|
|
14
20
|
* The timestamp of the last pin in the channel.
|
|
15
21
|
*/
|
|
16
|
-
lastPinTimestamp
|
|
22
|
+
get lastPinTimestamp(): IfPartial<IsPartial, string | null>;
|
|
17
23
|
/**
|
|
18
24
|
* The rate limit per user for the channel, in seconds.
|
|
19
25
|
*/
|
|
20
|
-
rateLimitPerUser
|
|
21
|
-
protected setSpecificData(data: APIGuildTextChannel<Type>): void;
|
|
22
|
-
protected abstract setMoreSpecificData(data: APIGuildTextChannel<Type>): void;
|
|
26
|
+
get rateLimitPerUser(): IfPartial<IsPartial, number | undefined>;
|
|
23
27
|
/**
|
|
24
28
|
* The last message sent in the channel.
|
|
25
29
|
*
|
|
@@ -28,15 +32,15 @@ export declare abstract class BaseGuildTextChannel<Type extends GuildTextChannel
|
|
|
28
32
|
* This will always return a partial message, so you can use {@link Message.fetch} to get the full message data.
|
|
29
33
|
*
|
|
30
34
|
*/
|
|
31
|
-
get lastMessage(): Message | null
|
|
35
|
+
get lastMessage(): IfPartial<IsPartial, Message<true> | null>;
|
|
32
36
|
/**
|
|
33
37
|
* Get the pinned messages in the channel
|
|
34
38
|
*/
|
|
35
|
-
getPinnedMessages(): Promise<Message[]>;
|
|
39
|
+
getPinnedMessages(): Promise<Message<false>[]>;
|
|
36
40
|
/**
|
|
37
41
|
* Start a thread without an associated start message.
|
|
38
42
|
* If you want to start a thread with a start message, use {@link Message.startThread}
|
|
39
43
|
*/
|
|
40
|
-
startThread(data: RESTPostAPIChannelThreadsJSONBody): Promise<GuildThreadChannel<import("discord-api-types/v10").ThreadChannelType>>;
|
|
44
|
+
startThread(data: RESTPostAPIChannelThreadsJSONBody): Promise<GuildThreadChannel<import("discord-api-types/v10").ThreadChannelType, false>>;
|
|
41
45
|
}
|
|
42
46
|
//# sourceMappingURL=BaseGuildTextChannel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseGuildTextChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseGuildTextChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,mBAAmB,EAExB,KAAK,oBAAoB,EAEzB,KAAK,iCAAiC,EAEtC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,8BAAsB,oBAAoB,CACzC,IAAI,SAAS,oBAAoB,CAChC,SAAQ,gBAAgB,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseGuildTextChannel.d.ts","sourceRoot":"","sources":["../../../src/abstracts/BaseGuildTextChannel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,mBAAmB,EAExB,KAAK,oBAAoB,EAEzB,KAAK,iCAAiC,EAEtC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,8BAAsB,oBAAoB,CACzC,IAAI,SAAS,oBAAoB,EACjC,SAAS,SAAS,OAAO,GAAG,KAAK,CAChC,SAAQ,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAC;IAClC,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAEjD;;OAEG;IACH,IAAI,KAAK,I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