diff --git a/packages/api-types/README.md b/packages/api-types/README.md
index 8ecc9d5..122390a 100644
--- a/packages/api-types/README.md
+++ b/packages/api-types/README.md
@@ -1,4 +1,6 @@
# @biscuitland/api-types
+## Most importantly, api-types is:
+1:1 type definitions package for the [Discord](https://discord.com/developers/docs/intro) API.
[
](https://github.com/oasisjs/biscuit)
[
](https://discord.gg/XNw2RZFzaP)
@@ -12,10 +14,6 @@ npm install @biscuitland/api-types
yarn add @biscuitland/api-types
```
-## Most importantly, api-types is:
-
-1:1 type definitions package for the [Discord](https://discord.com/developers/docs/intro) API:
-
## Example
```ts
diff --git a/packages/cache/README.md b/packages/cache/README.md
index 88f30a9..baeb998 100644
--- a/packages/cache/README.md
+++ b/packages/cache/README.md
@@ -1,9 +1,9 @@
# @biscuitland/cache
+Structures to create a custom cache completely decoupled from the rest of the library. You can choose to use a `MemoryCacheAdapter` or a `RedisCacheAdapter` according to your needs.
+
[
](https://github.com/oasisjs/biscuit)
[
](https://discord.gg/XNw2RZFzaP)
-Structures to create a custom cache completely decoupled from the rest of the library. You can choose to use a `MemoryCacheAdapter` or a `RedisCacheAdapter` according to your needs.
-
## Links
* [Website](https://biscuitjs.com/)
* [Documentation](https://docs.biscuitjs.com/)
diff --git a/packages/core/README.md b/packages/core/README.md
index e7460f7..47a4b23 100644
--- a/packages/core/README.md
+++ b/packages/core/README.md
@@ -1,9 +1,9 @@
# @biscuitland/core
+Classes, functions and main structures to create an application with biscuit. Core contains the essentials to launch you to develop your own customized and scalable bot.
+
[
](https://github.com/oasisjs/biscuit)
[
](https://discord.gg/XNw2RZFzaP)
-Classes, functions and main structures to create an application with biscuit. Core contains the essentials to launch you to develop your own customized and scalable bot.
-
## Getting Started
### Install (for [node18](https://nodejs.org/en/download/))
diff --git a/packages/core/src/structures/channels.ts b/packages/core/src/structures/channels.ts
index f98dd25..365ad5c 100644
--- a/packages/core/src/structures/channels.ts
+++ b/packages/core/src/structures/channels.ts
@@ -109,6 +109,17 @@ export abstract class BaseChannel implements Model {
return ChannelFactory.from(this.session, channel);
}
+ /**
+ * Deletes a channel.
+ * @param channelId The channel id to delete.
+ * @link https://discord.com/developers/docs/topics/gateway#channel-delete
+ */
+ async delete(channelId?: Snowflake): Promise {
+ const deleted = await this.session.rest.delete(CHANNEL(channelId ?? this.id));
+
+ return ChannelFactory.from(this.session, deleted);
+ }
+
toString(): string {
return `<#${this.id}>`;
}
@@ -527,6 +538,12 @@ export interface ReturnThreadsArchive {
hasMore: boolean;
}
+/**
+ * Represents a GuildChannel.
+ * @extends BaseChannel
+ * @see {@link BaseChannel}
+ * @link https://discord.com/developers/docs/resources/channel#channel-object
+ */
export class GuildChannel extends BaseChannel implements Model {
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
super(session, data);
@@ -540,19 +557,32 @@ export class GuildChannel extends BaseChannel implements Model {
: [];
}
+ /** Channel type. */
override type: Exclude;
+ /** Guild id. */
guildId: Snowflake;
+ /** Channel topic */
topic?: string;
+ /** Sorting position of the channel */
position?: number;
+ /** Id of the parent category for a channel (each parent category can contain up to 50 channels). */
parentId?: Snowflake;
+ /** Explicit permission overwrites for members and roles */
permissionOverwrites: PermissionsOverwrites[];
+ /**
+ * Gets the channel invites for the channel.
+ */
async fetchInvites(): Promise {
const invites = await this.session.rest.get(CHANNEL_INVITES(this.id));
return invites.map(invite => new Invite(this.session, invite));
}
+ /**
+ * Edits the channel.
+ * @param options - Options for edit the channel.
+ */
async edit(options: EditNewsChannelOptions): Promise;
async edit(options: EditStageChannelOptions): Promise;
async edit(options: EditVoiceChannelOptions): Promise;
@@ -582,6 +612,10 @@ export class GuildChannel extends BaseChannel implements Model {
return ChannelFactory.from(this.session, channel);
}
+ /**
+ * Gets the channel archived threads.
+ * @param options - Options for select the archved threads.
+ */
async getArchivedThreads(
options: ListArchivedThreads & { type: 'public' | 'private' | 'privateJoinedThreads' },
): Promise {
@@ -614,6 +648,10 @@ export class GuildChannel extends BaseChannel implements Model {
};
}
+ /**
+ * Creates a new thread in the channel.
+ * @param options - Options for create a thread channel.
+ */
async createThread(options: ThreadCreateOptions): Promise {
const thread = await this.session.rest.post(
'messageId' in options
@@ -627,6 +665,14 @@ export class GuildChannel extends BaseChannel implements Model {
return new ThreadChannel(this.session, thread, thread.guild_id ?? this.guildId);
}
+
+ /**
+ * Sets the channel's permissions overwrites. Same as GuildChannel.edit({ permissionOverwrites: ... }).
+ * @param overwrites - The overwrites to add to the channel.
+ */
+ async setPermissions(overwrites: PermissionsOverwrites[]): Promise {
+ return this.edit({ permissionOverwrites: overwrites } as EditGuildChannelOptions)
+ }
}
/** BaseVoiceChannel */
diff --git a/packages/core/src/structures/members.ts b/packages/core/src/structures/members.ts
index 7e2cceb..ecfb7cd 100644
--- a/packages/core/src/structures/members.ts
+++ b/packages/core/src/structures/members.ts
@@ -195,6 +195,14 @@ export class Member implements Model {
return Util.formatImageURL(url, options.size ?? 128, options.format);
}
+ /**
+ * Sets a new nickname for this member. Same as Member.edit({ nick: ... })
+ * @param nick - The new nickname for the member.
+ */
+ async setNickname(nick: string): Promise {
+ return this.edit({ nick });
+ }
+
toString(): string {
return `<@!${this.user.id}>`;
}
diff --git a/packages/helpers/README.md b/packages/helpers/README.md
index da873d0..5aa1634 100644
--- a/packages/helpers/README.md
+++ b/packages/helpers/README.md
@@ -1,4 +1,7 @@
# @biscuitland/helpers
+## Most importantly, helpers is:
+Collectors, builders and other helper functions such as setPresence.
+
[
](https://github.com/oasisjs/biscuit)
[
](https://discord.gg/XNw2RZFzaP)
@@ -11,11 +14,6 @@ npm install @biscuitland/helpers
yarn add @biscuitland/helpers
```
-## Most importantly, helpers is:
-- Collectors
-- Builders
-- Other helper functions such as setPresence
-
## Links
* [Website](https://biscuitjs.com/)
* [Documentation](https://docs.biscuitjs.com/)
diff --git a/packages/rest/README.md b/packages/rest/README.md
index 8655acb..ec23717 100644
--- a/packages/rest/README.md
+++ b/packages/rest/README.md
@@ -1,4 +1,7 @@
# @biscuitland/rest
+## Most importantly, biscuit's rest is:
+A standalone rest library that is yet easy to use and easy to host on a serverless infrastructure, it is meant to be used with biscuit's libraries.
+
[
](https://github.com/oasisjs/biscuit)
[
](https://discord.gg/XNw2RZFzaP)
@@ -11,9 +14,6 @@ npm install @biscuitland/rest
yarn add @biscuitland/rest
```
-## Most importantly, biscuit's rest is:
-A standalone rest library that is yet easy to use and easy to host on a serverless infrastructure, it is meant to be used with biscuit's libraries.
-
## Example (Standalone rest)
```ts
import { DefaultRestAdapter } from "@biscuitland/rest";
diff --git a/packages/ws/README.md b/packages/ws/README.md
index c1dd100..0ced763 100644
--- a/packages/ws/README.md
+++ b/packages/ws/README.md
@@ -1,4 +1,7 @@
# @biscuitland/ws
+## Most importantly, biscuit's ws is:
+A standalone gateway to interface Discord, it is meant to be used with a rest manager to send fetch requests to Discord
+
[
](https://github.com/oasisjs/biscuit)
[
](https://discord.gg/XNw2RZFzaP)
@@ -11,9 +14,6 @@ npm install @biscuitland/ws
yarn add @biscuitland/ws
```
-## Most importantly, biscuit's ws is:
-A standalone gateway to interface Discord, it is meant to be used with a rest manager to send fetch requests to Discord
-
## Example (GW proxy)
```ts
import { DefaultWsAdapter } from "@biscuitland/ws";