mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
Add invite type (#3614)
This commit is contained in:
@@ -317,6 +317,7 @@ export interface Transformers {
|
||||
context: boolean
|
||||
}
|
||||
invite: {
|
||||
type: boolean
|
||||
channelId: boolean
|
||||
code: boolean
|
||||
createdAt: boolean
|
||||
@@ -936,6 +937,7 @@ export function createTransformers(options: Partial<Transformers>, opts?: Create
|
||||
context: opts?.defaultDesiredPropertiesValue ?? false,
|
||||
},
|
||||
invite: {
|
||||
type: opts?.defaultDesiredPropertiesValue ?? false,
|
||||
channelId: opts?.defaultDesiredPropertiesValue ?? false,
|
||||
code: opts?.defaultDesiredPropertiesValue ?? false,
|
||||
createdAt: opts?.defaultDesiredPropertiesValue ?? false,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DiscordApplication, DiscordInviteCreate, DiscordInviteMetadata } from '@discordeno/types'
|
||||
import type { DiscordApplication, DiscordInviteCreate, DiscordInviteMetadata, DiscordInviteType } from '@discordeno/types'
|
||||
import { isInviteWithMetadata, type Application, type Bot, type ScheduledEvent, type User } from '../index.js'
|
||||
import type { InviteStageInstance } from './stageInviteInstance.js'
|
||||
|
||||
@@ -6,6 +6,7 @@ export function transformInvite(bot: Bot, payload: { invite: DiscordInviteCreate
|
||||
const props = bot.transformers.desiredProperties.invite
|
||||
const invite = {} as Invite
|
||||
|
||||
if (props.type && 'type' in payload.invite) invite.type = payload.invite.type
|
||||
if (props.code && payload.invite.code) invite.code = payload.invite.code
|
||||
if (props.createdAt && payload.invite.created_at) invite.createdAt = Date.parse(payload.invite.created_at)
|
||||
if (props.inviter && payload.invite.inviter) invite.inviter = bot.transformers.user(bot, payload.invite.inviter)
|
||||
@@ -48,6 +49,8 @@ export function transformInvite(bot: Bot, payload: { invite: DiscordInviteCreate
|
||||
}
|
||||
|
||||
export interface Invite {
|
||||
/** The type of invite */
|
||||
type: DiscordInviteType
|
||||
/** The channel the invite is for */
|
||||
channelId: bigint
|
||||
/** The unique invite code */
|
||||
|
||||
Reference in New Issue
Block a user