Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@vladfrangu/async_event_emitter": "^2.4.7",
"json-with-bigint": "^3.4.4",
"solid-js": "^1.9.14",
"stoat-api": "0.15.3",
"stoat-api": "0.16.0",
"ulid": "^3.0.2"
},
"devDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/classes/Channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
Member as APIMember,
Message as APIMessage,
User as APIUser,
DataCreateInvite,
DataEditChannel,
DataMessageSearch,
DataMessageSend,
Expand Down Expand Up @@ -709,12 +710,14 @@ export class Channel {

/**
* Create an invite to the channel
* @param data Invite options
* @requires `TextChannel`
* @returns Newly created invite code
*/
async createInvite(): Promise<Invite> {
async createInvite(data: DataCreateInvite = {}): Promise<Invite> {
return await this.#collection.client.api.post(
`/channels/${this.id as ""}/invites`,
data,
);
}

Expand Down
7 changes: 7 additions & 0 deletions src/classes/Invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export class ServerInvite extends ChannelInvite {
readonly creatorId: string;
readonly serverId: string;
readonly channelId: string;
readonly uses?: number;
readonly maxUses?: number;
readonly expires?: Date;

/**
* Construct Server Invite
Expand All @@ -65,6 +68,10 @@ export class ServerInvite extends ChannelInvite {
this.creatorId = invite.creator;
this.serverId = invite.server;
this.channelId = invite.channel;

this.uses = invite.uses;
this.maxUses = invite.max_uses ?? undefined;
this.expires = invite.expires ? new Date(invite.expires) : undefined;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/classes/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,13 @@ export class Server {
this.id,
hydrate(
"server",
await this.#collection.client.api.patch(
// Cast as APIServer because TypeScript matches both /roles/ranks and /roles/${role_id} in stoat-api routes
(await this.#collection.client.api.patch(
`/servers/${this.id as ""}/roles/ranks`,
{
ranks: roleIds,
},
),
)) as APIServer,
this.#collection.client,
false,
),
Expand Down
Loading