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
|
# @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/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)
|
[<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
|
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
|
## Example
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
|
4
packages/cache/README.md
vendored
4
packages/cache/README.md
vendored
@ -1,9 +1,9 @@
|
|||||||
# @biscuitland/cache
|
# @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/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)
|
[<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
|
## Links
|
||||||
* [Website](https://biscuitjs.com/)
|
* [Website](https://biscuitjs.com/)
|
||||||
* [Documentation](https://docs.biscuitjs.com/)
|
* [Documentation](https://docs.biscuitjs.com/)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# @biscuitland/core
|
# @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/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)
|
[<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
|
## Getting Started
|
||||||
|
|
||||||
### Install (for [node18](https://nodejs.org/en/download/))
|
### Install (for [node18](https://nodejs.org/en/download/))
|
||||||
|
@ -109,6 +109,17 @@ export abstract class BaseChannel implements Model {
|
|||||||
return ChannelFactory.from(this.session, channel);
|
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 {
|
toString(): string {
|
||||||
return `<#${this.id}>`;
|
return `<#${this.id}>`;
|
||||||
}
|
}
|
||||||
@ -527,6 +538,12 @@ export interface ReturnThreadsArchive {
|
|||||||
hasMore: boolean;
|
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 {
|
export class GuildChannel extends BaseChannel implements Model {
|
||||||
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
constructor(session: Session, data: DiscordChannel, guildId: Snowflake) {
|
||||||
super(session, data);
|
super(session, data);
|
||||||
@ -540,19 +557,32 @@ export class GuildChannel extends BaseChannel implements Model {
|
|||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Channel type. */
|
||||||
override type: Exclude<ChannelTypes, ChannelTypes.DM | ChannelTypes.GroupDm>;
|
override type: Exclude<ChannelTypes, ChannelTypes.DM | ChannelTypes.GroupDm>;
|
||||||
|
/** Guild id. */
|
||||||
guildId: Snowflake;
|
guildId: Snowflake;
|
||||||
|
/** Channel topic */
|
||||||
topic?: string;
|
topic?: string;
|
||||||
|
/** Sorting position of the channel */
|
||||||
position?: number;
|
position?: number;
|
||||||
|
/** Id of the parent category for a channel (each parent category can contain up to 50 channels). */
|
||||||
parentId?: Snowflake;
|
parentId?: Snowflake;
|
||||||
|
/** Explicit permission overwrites for members and roles */
|
||||||
permissionOverwrites: PermissionsOverwrites[];
|
permissionOverwrites: PermissionsOverwrites[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the channel invites for the channel.
|
||||||
|
*/
|
||||||
async fetchInvites(): Promise<Invite[]> {
|
async fetchInvites(): Promise<Invite[]> {
|
||||||
const invites = await this.session.rest.get<DiscordInviteMetadata[]>(CHANNEL_INVITES(this.id));
|
const invites = await this.session.rest.get<DiscordInviteMetadata[]>(CHANNEL_INVITES(this.id));
|
||||||
|
|
||||||
return invites.map(invite => new Invite(this.session, invite));
|
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: EditNewsChannelOptions): Promise<NewsChannel>;
|
||||||
async edit(options: EditStageChannelOptions): Promise<StageChannel>;
|
async edit(options: EditStageChannelOptions): Promise<StageChannel>;
|
||||||
async edit(options: EditVoiceChannelOptions): Promise<VoiceChannel>;
|
async edit(options: EditVoiceChannelOptions): Promise<VoiceChannel>;
|
||||||
@ -582,6 +612,10 @@ export class GuildChannel extends BaseChannel implements Model {
|
|||||||
return ChannelFactory.from(this.session, channel);
|
return ChannelFactory.from(this.session, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the channel archived threads.
|
||||||
|
* @param options - Options for select the archved threads.
|
||||||
|
*/
|
||||||
async getArchivedThreads(
|
async getArchivedThreads(
|
||||||
options: ListArchivedThreads & { type: 'public' | 'private' | 'privateJoinedThreads' },
|
options: ListArchivedThreads & { type: 'public' | 'private' | 'privateJoinedThreads' },
|
||||||
): Promise<ReturnThreadsArchive> {
|
): 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> {
|
async createThread(options: ThreadCreateOptions): Promise<ThreadChannel> {
|
||||||
const thread = await this.session.rest.post<DiscordChannel>(
|
const thread = await this.session.rest.post<DiscordChannel>(
|
||||||
'messageId' in options
|
'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);
|
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 */
|
/** BaseVoiceChannel */
|
||||||
|
@ -195,6 +195,14 @@ export class Member implements Model {
|
|||||||
return Util.formatImageURL(url, options.size ?? 128, options.format);
|
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 {
|
toString(): string {
|
||||||
return `<@!${this.user.id}>`;
|
return `<@!${this.user.id}>`;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
# @biscuitland/helpers
|
# @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/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)
|
[<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
|
yarn add @biscuitland/helpers
|
||||||
```
|
```
|
||||||
|
|
||||||
## Most importantly, helpers is:
|
|
||||||
- Collectors
|
|
||||||
- Builders
|
|
||||||
- Other helper functions such as setPresence
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
* [Website](https://biscuitjs.com/)
|
* [Website](https://biscuitjs.com/)
|
||||||
* [Documentation](https://docs.biscuitjs.com/)
|
* [Documentation](https://docs.biscuitjs.com/)
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
# @biscuitland/rest
|
# @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/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)
|
[<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
|
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)
|
## Example (Standalone rest)
|
||||||
```ts
|
```ts
|
||||||
import { DefaultRestAdapter } from "@biscuitland/rest";
|
import { DefaultRestAdapter } from "@biscuitland/rest";
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
# @biscuitland/ws
|
# @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/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)
|
[<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
|
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)
|
## Example (GW proxy)
|
||||||
```ts
|
```ts
|
||||||
import { DefaultWsAdapter } from "@biscuitland/ws";
|
import { DefaultWsAdapter } from "@biscuitland/ws";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user