types: add invite types (#703)

This commit is contained in:
ayntee
2021-03-28 22:17:00 +04:00
committed by GitHub
parent 8f6314db21
commit 855c7f46fc
4 changed files with 56 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
import { SnakeCaseProps } from "../util.ts";
export interface GetInvite {
/** Whether the invite should contain approximate member counts */
with_counts?: boolean;
}
/** https://discord.com/developers/docs/resources/invite#get-invite */
export type DiscordGetInvite = SnakeCaseProps<GetInvite>;
+26
View File
@@ -0,0 +1,26 @@
import { Channel } from "../channels/channel.ts";
import { User } from "../users/user.ts";
import { SnakeCaseProps } from "../util.ts";
import { DiscordTargetUserTypes } from "./target_user_types.ts";
export interface Invite {
/** The invite code (unique ID) */
code: string;
/** The guild this invite is for */
guild?: Partial<Guild>;
/** The channel this invite is for */
channel: Partial<Channel>;
/** The user who created the invite */
inviter?: User;
/** The target user for this invite */
targetUser?: User;
/** The type of user target for this invite */
targetUserType?: DiscordTargetUserTypes;
/** Approximate count of online members (only present when target_user is set) */
approximatePresenceCount?: number;
/** Approximate count of total members */
approximateMemberCount?: number;
}
/** https://discord.com/developers/docs/resources/invite#invite-object */
export type DiscordInvite = SnakeCaseProps<Invite>;
+17
View File
@@ -0,0 +1,17 @@
import { SnakeCaseProps } from "../util.ts";
export interface InviteMetadata {
/** Number of times this invite has been used */
uses: number;
/** Max number of times this invite can be used */
maxUses: number;
/** Duration (in seconds) after which the invite expires */
maxAge: number;
/** Whether this invite only grants temporary membership */
temporary: boolean;
/** When this invite was created */
createdAt: string;
}
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object */
export type DiscordInviteMetadata = SnakeCaseProps<InviteMetadata>;
+4
View File
@@ -0,0 +1,4 @@
/** https://discord.com/developers/docs/resources/invite#invite-object-target-user-types */
export enum DiscordTargetUserTypes {
STREAM = 1,
}