mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-04 22:16:08 +00:00
Update channels, member and readme's (#94)
This commit is contained in:
parent
3abe639fd1
commit
960cd147c5
@ -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.
|
||||
|
||||
[<img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">](https://github.com/oasisjs/biscuit)
|
||||
[<img src="https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white">](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
|
||||
|
4
packages/cache/README.md
vendored
4
packages/cache/README.md
vendored
@ -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.
|
||||
|
||||
[<img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">](https://github.com/oasisjs/biscuit)
|
||||
[<img src="https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white">](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/)
|
||||
|
@ -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.
|
||||
|
||||
[<img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">](https://github.com/oasisjs/biscuit)
|
||||
[<img src="https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white">](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/))
|
||||
|
@ -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<Channel> {
|
||||
const deleted = await this.session.rest.delete<DiscordChannel>(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<ChannelTypes, ChannelTypes.DM | ChannelTypes.GroupDm>;
|
||||
/** 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<Invite[]> {
|
||||
const invites = await this.session.rest.get<DiscordInviteMetadata[]>(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<NewsChannel>;
|
||||
async edit(options: EditStageChannelOptions): Promise<StageChannel>;
|
||||
async edit(options: EditVoiceChannelOptions): Promise<VoiceChannel>;
|
||||
@ -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<ReturnThreadsArchive> {
|
||||
@ -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<ThreadChannel> {
|
||||
const thread = await this.session.rest.post<DiscordChannel>(
|
||||
'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<Channel> {
|
||||
return this.edit({ permissionOverwrites: overwrites } as EditGuildChannelOptions)
|
||||
}
|
||||
}
|
||||
|
||||
/** BaseVoiceChannel */
|
||||
|
@ -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<Member> {
|
||||
return this.edit({ nick });
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
return `<@!${this.user.id}>`;
|
||||
}
|
||||
|
@ -1,4 +1,7 @@
|
||||
# @biscuitland/helpers
|
||||
## Most importantly, helpers is:
|
||||
Collectors, builders and other helper functions such as setPresence.
|
||||
|
||||
[<img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">](https://github.com/oasisjs/biscuit)
|
||||
[<img src="https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white">](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/)
|
||||
|
@ -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.
|
||||
|
||||
[<img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">](https://github.com/oasisjs/biscuit)
|
||||
[<img src="https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white">](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";
|
||||
|
@ -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
|
||||
|
||||
[<img src="https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white">](https://github.com/oasisjs/biscuit)
|
||||
[<img src="https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white">](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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user