mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
feat: GuildChannel.fetchInvites
This commit is contained in:
parent
ea18fbc71d
commit
9e6a8699ff
@ -1,8 +1,9 @@
|
||||
import type { Model } from "./Base.ts";
|
||||
import type { Snowflake } from "../util/Snowflake.ts";
|
||||
import type { Session } from "../session/Session.ts";
|
||||
import type { DiscordChannel } from "../vendor/external.ts";
|
||||
import type { DiscordChannel, DiscordInviteMetadata } from "../vendor/external.ts";
|
||||
import Channel from "./Channel.ts";
|
||||
import Invite from "./Invite.ts";
|
||||
import * as Routes from "../util/Routes.ts";
|
||||
|
||||
export abstract class GuildChannel extends Channel implements Model {
|
||||
@ -19,6 +20,16 @@ export abstract class GuildChannel extends Channel implements Model {
|
||||
position?: number;
|
||||
parentId?: Snowflake;
|
||||
|
||||
async fetchInvites(): Promise<Invite[]> {
|
||||
const invites = await this.session.rest.runMethod<DiscordInviteMetadata[]>(
|
||||
this.session.rest,
|
||||
"GET",
|
||||
Routes.CHANNEL_INVITES(this.id),
|
||||
);
|
||||
|
||||
return invites.map((invite) => new Invite(this.session, invite));
|
||||
}
|
||||
|
||||
async delete(reason?: string) {
|
||||
await this.session.rest.runMethod<DiscordChannel>(
|
||||
this.session.rest,
|
||||
|
Loading…
x
Reference in New Issue
Block a user