mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
feat: api docs catchup part 1 (#3257)
* feat: add voice message support Closes #3009 * fix: pre-commit hook EACCESS npx issue * feat: add channel to interaction Closes #2979 * feat: add role flags Closes #3070 * feat: adds creator monetization, message flagged, and member timeout audit log event Closes #3075 * feat: add attachment flags Closes #3071 * feat: add avatar decorations Closes #3081 * feat: update description for guild and channel permissions Closes #3106 * feat: rename Nitro sticker packs to just sticker packs Closes #3107 * feat: add integration type to audit log entry Closes #3108 * feat: make position optional on modify guild channel position Closes #3086 * feat: add guild media channel type and associated flag Closes #3093 * feat: update remark for activities.write scope Closes #3213 * feat: add support for super reactions Closes #3113 * fix: attempt to fix benchmarks * fix: benchmark attempt #2 --------- Co-authored-by: Fleny <Fleny113@outlook.com>
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
. "$(dirname -- "$0")/_/husky.sh"
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
npx lint-staged
|
yarn run lint-staged
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ import {
|
|||||||
TeamMembershipStates,
|
TeamMembershipStates,
|
||||||
TextStyles,
|
TextStyles,
|
||||||
UserFlags,
|
UserFlags,
|
||||||
|
createBot,
|
||||||
iconHashToBigInt,
|
iconHashToBigInt,
|
||||||
type Bot,
|
type Bot,
|
||||||
type DiscordMessage,
|
type DiscordMessage,
|
||||||
createBot,
|
|
||||||
} from '@discordeno/bot'
|
} from '@discordeno/bot'
|
||||||
import { memoryBenchmark } from '../utils/memoryBenchmark.js'
|
|
||||||
import { MemberToggles } from '@discordeno/bot/dist/transformers/index.js'
|
import { MemberToggles } from '@discordeno/bot/dist/transformers/index.js'
|
||||||
|
import { memoryBenchmark } from '../utils/memoryBenchmark.js'
|
||||||
|
|
||||||
export const CHANNEL_MENTION_REGEX = /<#[0-9]+>/g
|
export const CHANNEL_MENTION_REGEX = /<#[0-9]+>/g
|
||||||
|
|
||||||
@@ -337,6 +337,12 @@ await memoryBenchmark(
|
|||||||
name: 'discordeno',
|
name: 'discordeno',
|
||||||
},
|
},
|
||||||
me: true,
|
me: true,
|
||||||
|
me_burst: false,
|
||||||
|
count_details: {
|
||||||
|
normal: 100,
|
||||||
|
burst: 0,
|
||||||
|
},
|
||||||
|
burst_colors: [],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
sticker_items: [
|
sticker_items: [
|
||||||
@@ -370,7 +376,7 @@ await memoryBenchmark(
|
|||||||
tts: true,
|
tts: true,
|
||||||
type: MessageTypes.Default,
|
type: MessageTypes.Default,
|
||||||
webhook_id: GUILD_ID,
|
webhook_id: GUILD_ID,
|
||||||
}) as DiscordMessage,
|
}) as unknown as DiscordMessage,
|
||||||
), // array of event to test with
|
), // array of event to test with
|
||||||
{ times: 1, log: false, table: false },
|
{ times: 1, log: false, table: false },
|
||||||
)
|
)
|
||||||
@@ -715,6 +721,12 @@ await memoryBenchmark(
|
|||||||
name: 'discordeno',
|
name: 'discordeno',
|
||||||
},
|
},
|
||||||
me: true,
|
me: true,
|
||||||
|
me_burst: false,
|
||||||
|
count_details: {
|
||||||
|
normal: 100,
|
||||||
|
burst: 0,
|
||||||
|
},
|
||||||
|
burst_colors: [],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
sticker_items: [
|
sticker_items: [
|
||||||
@@ -748,7 +760,7 @@ await memoryBenchmark(
|
|||||||
tts: true,
|
tts: true,
|
||||||
type: MessageTypes.Default,
|
type: MessageTypes.Default,
|
||||||
webhook_id: GUILD_ID,
|
webhook_id: GUILD_ID,
|
||||||
}) as DiscordMessage,
|
}) as unknown as DiscordMessage,
|
||||||
), // array of event to test with
|
), // array of event to test with
|
||||||
{ times: 1, log: false, table: false },
|
{ times: 1, log: false, table: false },
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -375,8 +375,8 @@ export function createBotHelpers(bot: Bot): BotHelpers {
|
|||||||
getMessages: async (channelId, options) => {
|
getMessages: async (channelId, options) => {
|
||||||
return (await bot.rest.getMessages(channelId, options)).map((res) => bot.transformers.message(bot, snakelize(res)))
|
return (await bot.rest.getMessages(channelId, options)).map((res) => bot.transformers.message(bot, snakelize(res)))
|
||||||
},
|
},
|
||||||
getNitroStickerPacks: async () => {
|
getStickerPacks: async () => {
|
||||||
return (await bot.rest.getNitroStickerPacks()).map((res) => bot.transformers.stickerPack(bot, snakelize(res)))
|
return (await bot.rest.getStickerPacks()).map((res) => bot.transformers.stickerPack(bot, snakelize(res)))
|
||||||
},
|
},
|
||||||
getOriginalInteractionResponse: async (token) => {
|
getOriginalInteractionResponse: async (token) => {
|
||||||
return bot.transformers.message(bot, snakelize(await bot.rest.getOriginalInteractionResponse(token)))
|
return bot.transformers.message(bot, snakelize(await bot.rest.getOriginalInteractionResponse(token)))
|
||||||
@@ -790,7 +790,7 @@ export interface BotHelpers {
|
|||||||
getInvites: (guildId: BigString) => Promise<Invite[]>
|
getInvites: (guildId: BigString) => Promise<Invite[]>
|
||||||
getMessage: (channelId: BigString, messageId: BigString) => Promise<Message>
|
getMessage: (channelId: BigString, messageId: BigString) => Promise<Message>
|
||||||
getMessages: (channelId: BigString, options?: GetMessagesOptions) => Promise<Message[]>
|
getMessages: (channelId: BigString, options?: GetMessagesOptions) => Promise<Message[]>
|
||||||
getNitroStickerPacks: () => Promise<StickerPack[]>
|
getStickerPacks: () => Promise<StickerPack[]>
|
||||||
getOriginalInteractionResponse: (token: string) => Promise<Message>
|
getOriginalInteractionResponse: (token: string) => Promise<Message>
|
||||||
getPinnedMessages: (channelId: BigString) => Promise<Message[]>
|
getPinnedMessages: (channelId: BigString) => Promise<Message[]>
|
||||||
getPrivateArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<CamelizedDiscordArchivedThreads>
|
getPrivateArchivedThreads: (channelId: BigString, options?: ListArchivedThreads) => Promise<CamelizedDiscordArchivedThreads>
|
||||||
|
|||||||
@@ -169,6 +169,9 @@ export interface Transformers {
|
|||||||
width: boolean
|
width: boolean
|
||||||
ephemeral: boolean
|
ephemeral: boolean
|
||||||
description: boolean
|
description: boolean
|
||||||
|
duration_secs: boolean
|
||||||
|
waveform: boolean
|
||||||
|
flags: boolean
|
||||||
}
|
}
|
||||||
channel: {
|
channel: {
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -268,6 +271,7 @@ export interface Transformers {
|
|||||||
applicationId: boolean
|
applicationId: boolean
|
||||||
type: boolean
|
type: boolean
|
||||||
guildId: boolean
|
guildId: boolean
|
||||||
|
channel: boolean
|
||||||
channelId: boolean
|
channelId: boolean
|
||||||
member: boolean
|
member: boolean
|
||||||
user: boolean
|
user: boolean
|
||||||
@@ -364,6 +368,7 @@ export interface Transformers {
|
|||||||
hoist: boolean
|
hoist: boolean
|
||||||
managed: boolean
|
managed: boolean
|
||||||
subscriptionListingId: boolean
|
subscriptionListingId: boolean
|
||||||
|
flags: boolean
|
||||||
}
|
}
|
||||||
scheduledEvent: {
|
scheduledEvent: {
|
||||||
id: boolean
|
id: boolean
|
||||||
@@ -426,6 +431,7 @@ export interface Transformers {
|
|||||||
verified: boolean
|
verified: boolean
|
||||||
email: boolean
|
email: boolean
|
||||||
banner: boolean
|
banner: boolean
|
||||||
|
avatarDecoration: boolean
|
||||||
}
|
}
|
||||||
webhook: {
|
webhook: {
|
||||||
id: boolean
|
id: boolean
|
||||||
@@ -652,6 +658,9 @@ export function createTransformers(options: Partial<Transformers>, opts?: Create
|
|||||||
width: opts?.defaultDesiredPropertiesValue ?? false,
|
width: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
ephemeral: opts?.defaultDesiredPropertiesValue ?? false,
|
ephemeral: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
description: opts?.defaultDesiredPropertiesValue ?? false,
|
description: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
|
duration_secs: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
|
waveform: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
|
flags: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
},
|
},
|
||||||
channel: {
|
channel: {
|
||||||
type: opts?.defaultDesiredPropertiesValue ?? false,
|
type: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
@@ -751,6 +760,7 @@ export function createTransformers(options: Partial<Transformers>, opts?: Create
|
|||||||
applicationId: opts?.defaultDesiredPropertiesValue ?? false,
|
applicationId: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
type: opts?.defaultDesiredPropertiesValue ?? false,
|
type: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
guildId: opts?.defaultDesiredPropertiesValue ?? false,
|
guildId: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
|
channel: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
channelId: opts?.defaultDesiredPropertiesValue ?? false,
|
channelId: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
member: opts?.defaultDesiredPropertiesValue ?? false,
|
member: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
user: opts?.defaultDesiredPropertiesValue ?? false,
|
user: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
@@ -847,6 +857,7 @@ export function createTransformers(options: Partial<Transformers>, opts?: Create
|
|||||||
hoist: opts?.defaultDesiredPropertiesValue ?? false,
|
hoist: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
managed: opts?.defaultDesiredPropertiesValue ?? false,
|
managed: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
subscriptionListingId: opts?.defaultDesiredPropertiesValue ?? false,
|
subscriptionListingId: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
|
flags: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
},
|
},
|
||||||
scheduledEvent: {
|
scheduledEvent: {
|
||||||
id: opts?.defaultDesiredPropertiesValue ?? false,
|
id: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
@@ -909,6 +920,7 @@ export function createTransformers(options: Partial<Transformers>, opts?: Create
|
|||||||
verified: opts?.defaultDesiredPropertiesValue ?? false,
|
verified: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
email: opts?.defaultDesiredPropertiesValue ?? false,
|
email: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
banner: opts?.defaultDesiredPropertiesValue ?? false,
|
banner: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
|
avatarDecoration: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
},
|
},
|
||||||
webhook: {
|
webhook: {
|
||||||
id: opts?.defaultDesiredPropertiesValue ?? false,
|
id: opts?.defaultDesiredPropertiesValue ?? false,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { DiscordAttachment } from '@discordeno/types'
|
import type { AttachmentFlags, DiscordAttachment } from '@discordeno/types'
|
||||||
import type { Bot } from '../index.js'
|
import type { Bot } from '../index.js'
|
||||||
|
|
||||||
export function transformAttachment(bot: Bot, payload: DiscordAttachment): Attachment {
|
export function transformAttachment(bot: Bot, payload: DiscordAttachment): Attachment {
|
||||||
@@ -15,6 +15,9 @@ export function transformAttachment(bot: Bot, payload: DiscordAttachment): Attac
|
|||||||
if (props.width && payload.width) attachment.width = payload.width
|
if (props.width && payload.width) attachment.width = payload.width
|
||||||
if (props.ephemeral && payload.ephemeral) attachment.ephemeral = payload.ephemeral
|
if (props.ephemeral && payload.ephemeral) attachment.ephemeral = payload.ephemeral
|
||||||
if (props.description && payload.description) attachment.description = payload.description
|
if (props.description && payload.description) attachment.description = payload.description
|
||||||
|
if (props.duration_secs && payload.duration_secs) attachment.duration_secs = payload.duration_secs
|
||||||
|
if (props.waveform && payload.waveform) attachment.waveform = payload.waveform
|
||||||
|
if (props.flags && payload.flags) attachment.flags = payload.flags
|
||||||
|
|
||||||
return bot.transformers.customizers.attachment(bot, payload, attachment)
|
return bot.transformers.customizers.attachment(bot, payload, attachment)
|
||||||
}
|
}
|
||||||
@@ -44,4 +47,10 @@ export interface Attachment {
|
|||||||
* Ephemeral attachments on messages are guaranteed to be available as long as the message itself exists.
|
* Ephemeral attachments on messages are guaranteed to be available as long as the message itself exists.
|
||||||
*/
|
*/
|
||||||
ephemeral?: boolean
|
ephemeral?: boolean
|
||||||
|
/** The duration of the audio file for a voice message */
|
||||||
|
duration_secs?: number
|
||||||
|
/** A base64 encoded bytearray representing a sampled waveform for a voice message */
|
||||||
|
waveform?: string
|
||||||
|
/** Attachment flags combined as a bitfield */
|
||||||
|
flags?: AttachmentFlags
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ export function transformAuditLogEntry(bot: Bot, payload: DiscordAuditLogEntry):
|
|||||||
roleName: payload.options.role_name,
|
roleName: payload.options.role_name,
|
||||||
autoModerationRuleName: payload.options.auto_moderation_rule_name,
|
autoModerationRuleName: payload.options.auto_moderation_rule_name,
|
||||||
autoModerationRuleTriggerType: payload.options.auto_moderation_rule_trigger_type,
|
autoModerationRuleTriggerType: payload.options.auto_moderation_rule_trigger_type,
|
||||||
|
integrationType: payload.options.integration_type,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
reason: payload.reason,
|
reason: payload.reason,
|
||||||
@@ -252,5 +253,6 @@ export interface AuditLogEntry {
|
|||||||
roleName: string
|
roleName: string
|
||||||
autoModerationRuleName: string
|
autoModerationRuleName: string
|
||||||
autoModerationRuleTriggerType: string
|
autoModerationRuleTriggerType: string
|
||||||
|
integrationType: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { BigString, ChannelTypes, DiscordChannel, DiscordThreadMember, OverwriteReadable, VideoQualityModes } from '@discordeno/types'
|
import type { BigString, ChannelTypes, DiscordChannel, DiscordThreadMember, OverwriteReadable, VideoQualityModes } from '@discordeno/types'
|
||||||
import { calculatePermissions, type Bot } from '../index.js'
|
import { calculatePermissions, type Bot } from '../index.js'
|
||||||
import { ChannelToggles } from './toggles/channel.js'
|
|
||||||
import { Permissions } from './toggles/Permissions.js'
|
import { Permissions } from './toggles/Permissions.js'
|
||||||
|
import { ChannelToggles } from './toggles/channel.js'
|
||||||
|
|
||||||
const Mask = (1n << 64n) - 1n
|
const Mask = (1n << 64n) - 1n
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ export interface Channel extends BaseChannel {
|
|||||||
member?: DiscordThreadMember
|
member?: DiscordThreadMember
|
||||||
/** Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
/** Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
||||||
default_auto_archive_duration?: number
|
default_auto_archive_duration?: number
|
||||||
/** computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a application command interaction */
|
/** computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction. This does not include implicit permissions, which may need to be checked separately. */
|
||||||
permissions?: Permissions
|
permissions?: Permissions
|
||||||
/** The flags of the channel */
|
/** The flags of the channel */
|
||||||
flags?: number
|
flags?: number
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ export interface Guild {
|
|||||||
discoverySplash?: bigint
|
discoverySplash?: bigint
|
||||||
/** Id of the owner */
|
/** Id of the owner */
|
||||||
ownerId: bigint
|
ownerId: bigint
|
||||||
/** Total permissions for the user in the guild (excludes overwrites) */
|
/** Total permissions for the user in the guild (excludes overwrites and implicit permissions) */
|
||||||
permissions: bigint
|
permissions: bigint
|
||||||
/** Id of afk channel */
|
/** Id of afk channel */
|
||||||
afkChannelId?: bigint
|
afkChannelId?: bigint
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
type MessageComponentTypes,
|
type MessageComponentTypes,
|
||||||
} from '@discordeno/types'
|
} from '@discordeno/types'
|
||||||
import { Collection } from '@discordeno/utils'
|
import { Collection } from '@discordeno/utils'
|
||||||
import type { Bot, Component } from '../index.js'
|
import type { Bot, Channel, Component, DiscordChannel } from '../index.js'
|
||||||
import type { DiscordInteractionDataResolved } from '../typings.js'
|
import type { DiscordInteractionDataResolved } from '../typings.js'
|
||||||
import type { Attachment } from './attachment.js'
|
import type { Attachment } from './attachment.js'
|
||||||
import type { Member } from './member.js'
|
import type { Member } from './member.js'
|
||||||
@@ -34,6 +34,13 @@ export interface Interaction extends BaseInteraction {
|
|||||||
/** The guild it was sent from */
|
/** The guild it was sent from */
|
||||||
guildId?: bigint
|
guildId?: bigint
|
||||||
/** The channel it was sent from */
|
/** The channel it was sent from */
|
||||||
|
channel: Partial<Channel>
|
||||||
|
/**
|
||||||
|
* The ID of channel it was sent from
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* It is recommended that you begin using this channel field to identify the source channel of the interaction as they may deprecate the existing channel_id field in the future.
|
||||||
|
*/
|
||||||
channelId?: bigint
|
channelId?: bigint
|
||||||
/** Guild member data for the invoking user, including permissions */
|
/** Guild member data for the invoking user, including permissions */
|
||||||
member?: Member
|
member?: Member
|
||||||
@@ -162,6 +169,7 @@ export function transformInteraction(bot: Bot, payload: DiscordInteraction): Int
|
|||||||
if (props.user) interaction.user = user
|
if (props.user) interaction.user = user
|
||||||
if (payload.app_permissions && props.appPermissions) interaction.appPermissions = bot.transformers.snowflake(payload.app_permissions)
|
if (payload.app_permissions && props.appPermissions) interaction.appPermissions = bot.transformers.snowflake(payload.app_permissions)
|
||||||
if (payload.message && props.message) interaction.message = bot.transformers.message(bot, payload.message)
|
if (payload.message && props.message) interaction.message = bot.transformers.message(bot, payload.message)
|
||||||
|
if (payload.channel && props.channel) interaction.channel = bot.transformers.channel(bot, { channel: payload.channel as DiscordChannel, guildId })
|
||||||
if (payload.channel_id && props.channelId) interaction.channelId = bot.transformers.snowflake(payload.channel_id)
|
if (payload.channel_id && props.channelId) interaction.channelId = bot.transformers.snowflake(payload.channel_id)
|
||||||
if (payload.member && guildId && props.member) interaction.member = bot.transformers.member(bot, payload.member, guildId, user.id)
|
if (payload.member && guildId && props.member) interaction.member = bot.transformers.member(bot, payload.member, guildId, user.id)
|
||||||
if (payload.data && props.data) {
|
if (payload.data && props.data) {
|
||||||
|
|||||||
@@ -225,10 +225,21 @@ export interface Message extends MessageBase {
|
|||||||
reactions?: Array<{
|
reactions?: Array<{
|
||||||
/** Whether the current user reacted using this emoji */
|
/** Whether the current user reacted using this emoji */
|
||||||
me: boolean
|
me: boolean
|
||||||
|
/** Whether the current user super-reacted using this emoji */
|
||||||
|
meBurst: boolean
|
||||||
/** Times this emoji has been used to react */
|
/** Times this emoji has been used to react */
|
||||||
count: number
|
count: number
|
||||||
|
/** Reaction count details object */
|
||||||
|
countDetails: {
|
||||||
|
/** Count of super reactions */
|
||||||
|
burst: number
|
||||||
|
/** Count of normal reactions */
|
||||||
|
normal: number
|
||||||
|
}
|
||||||
/** Emoji information */
|
/** Emoji information */
|
||||||
emoji: Emoji
|
emoji: Emoji
|
||||||
|
/** HEX colors used for super reaction */
|
||||||
|
burstColors: string[]
|
||||||
}>
|
}>
|
||||||
/** Sent if the message contains stickers */
|
/** Sent if the message contains stickers */
|
||||||
stickerItems?: Array<{
|
stickerItems?: Array<{
|
||||||
@@ -341,8 +352,14 @@ export function transformMessage(bot: Bot, payload: DiscordMessage): Message {
|
|||||||
if (payload.reactions?.length && props.reactions) {
|
if (payload.reactions?.length && props.reactions) {
|
||||||
message.reactions = payload.reactions.map((reaction) => ({
|
message.reactions = payload.reactions.map((reaction) => ({
|
||||||
me: reaction.me,
|
me: reaction.me,
|
||||||
|
meBurst: reaction.me_burst,
|
||||||
count: reaction.count,
|
count: reaction.count,
|
||||||
|
countDetails: {
|
||||||
|
burst: reaction.count_details.burst,
|
||||||
|
normal: reaction.count_details.normal,
|
||||||
|
},
|
||||||
emoji: bot.transformers.emoji(bot, reaction.emoji),
|
emoji: bot.transformers.emoji(bot, reaction.emoji),
|
||||||
|
burstColors: reaction.burst_colors,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
if (props.stickerItems && payload.sticker_items?.length)
|
if (props.stickerItems && payload.sticker_items?.length)
|
||||||
|
|||||||
@@ -13,5 +13,8 @@ export function transformAttachmentToDiscordAttachment(bot: Bot, payload: Attach
|
|||||||
width: payload.width,
|
width: payload.width,
|
||||||
ephemeral: payload.ephemeral,
|
ephemeral: payload.ephemeral,
|
||||||
description: payload.description,
|
description: payload.description,
|
||||||
|
duration_secs: payload.duration_secs,
|
||||||
|
waveform: payload.waveform,
|
||||||
|
flags: payload.flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ export function transformAuditLogEntryToDiscordAuditLogEntry(bot: Bot, payload:
|
|||||||
application_id: '',
|
application_id: '',
|
||||||
auto_moderation_rule_name: payload.options.autoModerationRuleName,
|
auto_moderation_rule_name: payload.options.autoModerationRuleName,
|
||||||
auto_moderation_rule_trigger_type: payload.options.autoModerationRuleTriggerType,
|
auto_moderation_rule_trigger_type: payload.options.autoModerationRuleTriggerType,
|
||||||
|
integration_type: payload.options.integrationType,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
reason: payload.reason,
|
reason: payload.reason,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { BigString, DiscordRole } from '@discordeno/types'
|
import type { BigString, DiscordRole, RoleFlags } from '@discordeno/types'
|
||||||
import { iconHashToBigInt, type Bot } from '../index.js'
|
import { iconHashToBigInt, type Bot } from '../index.js'
|
||||||
import { Permissions } from './toggles/Permissions.js'
|
import { Permissions } from './toggles/Permissions.js'
|
||||||
import { RoleToggles } from './toggles/role.js'
|
import { RoleToggles } from './toggles/role.js'
|
||||||
@@ -51,6 +51,7 @@ export function transformRole(bot: Bot, payload: { role: DiscordRole } & { guild
|
|||||||
if (payload.role.permissions && props.permissions) role.permissions = new Permissions(payload.role.permissions)
|
if (payload.role.permissions && props.permissions) role.permissions = new Permissions(payload.role.permissions)
|
||||||
if (payload.role.icon && props.icon) role.icon = iconHashToBigInt(payload.role.icon)
|
if (payload.role.icon && props.icon) role.icon = iconHashToBigInt(payload.role.icon)
|
||||||
if (payload.role.unicode_emoji && props.unicodeEmoji) role.unicodeEmoji = payload.role.unicode_emoji
|
if (payload.role.unicode_emoji && props.unicodeEmoji) role.unicodeEmoji = payload.role.unicode_emoji
|
||||||
|
if (payload.role.flags && props.flags) role.flags = payload.role.flags
|
||||||
if (payload.role.tags && (props.botId || props.integrationId || props.subscriptionListingId)) {
|
if (payload.role.tags && (props.botId || props.integrationId || props.subscriptionListingId)) {
|
||||||
role.internalTags = {}
|
role.internalTags = {}
|
||||||
if (payload.role.tags.bot_id && props.botId) role.internalTags.botId = bot.transformers.snowflake(payload.role.tags.bot_id)
|
if (payload.role.tags.bot_id && props.botId) role.internalTags.botId = bot.transformers.snowflake(payload.role.tags.bot_id)
|
||||||
@@ -133,4 +134,6 @@ export interface Role extends BaseRole {
|
|||||||
position: number
|
position: number
|
||||||
/** role unicode emoji */
|
/** role unicode emoji */
|
||||||
unicodeEmoji?: string
|
unicodeEmoji?: string
|
||||||
|
/** Role flags combined as a bitfield */
|
||||||
|
flags: RoleFlags
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export function transformUser(bot: Bot, payload: DiscordUser): User {
|
|||||||
if (payload.premium_type && props.premiumType) user.premiumType = payload.premium_type
|
if (payload.premium_type && props.premiumType) user.premiumType = payload.premium_type
|
||||||
if (payload.avatar && props.avatar) user.avatar = iconHashToBigInt(payload.avatar)
|
if (payload.avatar && props.avatar) user.avatar = iconHashToBigInt(payload.avatar)
|
||||||
if (payload.banner && props.banner) user.banner = iconHashToBigInt(payload.banner)
|
if (payload.banner && props.banner) user.banner = iconHashToBigInt(payload.banner)
|
||||||
|
if (payload.avatar_decoration && props.avatarDecoration) user.avatarDecoration = iconHashToBigInt(payload.avatar_decoration)
|
||||||
if (payload.accent_color && props.accentColor) user.accentColor = payload.accent_color
|
if (payload.accent_color && props.accentColor) user.accentColor = payload.accent_color
|
||||||
|
|
||||||
return bot.transformers.customizers.user(bot, payload, user)
|
return bot.transformers.customizers.user(bot, payload, user)
|
||||||
@@ -84,4 +85,6 @@ export interface User extends BaseUser {
|
|||||||
email?: string
|
email?: string
|
||||||
/** the user's banner, or null if unset */
|
/** the user's banner, or null if unset */
|
||||||
banner?: bigint
|
banner?: bigint
|
||||||
|
/** the user's avatar decoration, or null if unset */
|
||||||
|
avatarDecoration?: bigint
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,4 +227,6 @@ export enum MessageFlags {
|
|||||||
FailedToMentionSomeRolesInThread = 1 << 8,
|
FailedToMentionSomeRolesInThread = 1 << 8,
|
||||||
/** Whether this message will not trigger push and desktop notifications */
|
/** Whether this message will not trigger push and desktop notifications */
|
||||||
SuppressNotifications = 1 << 12,
|
SuppressNotifications = 1 << 12,
|
||||||
|
/** Whether this message is a voice message */
|
||||||
|
IsVoiceMessage = 1 << 13,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1140,8 +1140,8 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage
|
|||||||
return await rest.get<DiscordMessage[]>(rest.routes.channels.messages(channelId, options))
|
return await rest.get<DiscordMessage[]>(rest.routes.channels.messages(channelId, options))
|
||||||
},
|
},
|
||||||
|
|
||||||
async getNitroStickerPacks() {
|
async getStickerPacks() {
|
||||||
return await rest.get<DiscordStickerPack[]>(rest.routes.nitroStickerPacks())
|
return await rest.get<DiscordStickerPack[]>(rest.routes.stickerPacks())
|
||||||
},
|
},
|
||||||
|
|
||||||
async getOriginalInteractionResponse(token) {
|
async getOriginalInteractionResponse(token) {
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ export function createRoutes(): RestRoutes {
|
|||||||
return '/gateway/bot'
|
return '/gateway/bot'
|
||||||
},
|
},
|
||||||
|
|
||||||
nitroStickerPacks() {
|
stickerPacks() {
|
||||||
return '/sticker-packs'
|
return '/sticker-packs'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1938,13 +1938,13 @@ export interface RestManager {
|
|||||||
*/
|
*/
|
||||||
getMessages: (channelId: BigString, options?: GetMessagesOptions) => Promise<CamelizedDiscordMessage[]>
|
getMessages: (channelId: BigString, options?: GetMessagesOptions) => Promise<CamelizedDiscordMessage[]>
|
||||||
/**
|
/**
|
||||||
* Returns the list of sticker packs available to Nitro subscribers.
|
* Returns the list of sticker packs available.
|
||||||
*
|
*
|
||||||
* @returns A collection of {@link StickerPack} objects assorted by sticker ID.
|
* @returns A collection of {@link StickerPack} objects assorted by sticker ID.
|
||||||
*
|
*
|
||||||
* @see {@link https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs}
|
* @see {@link https://discord.com/developers/docs/resources/sticker#list-sticker-packs}
|
||||||
*/
|
*/
|
||||||
getNitroStickerPacks: () => Promise<CamelizedDiscordStickerPack[]>
|
getStickerPacks: () => Promise<CamelizedDiscordStickerPack[]>
|
||||||
/**
|
/**
|
||||||
* Gets the initial message response to an interaction.
|
* Gets the initial message response to an interaction.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ export interface RestRoutes {
|
|||||||
user: (id: BigString) => string
|
user: (id: BigString) => string
|
||||||
// Gateway Bot
|
// Gateway Bot
|
||||||
gatewayBot: () => string
|
gatewayBot: () => string
|
||||||
// Nitro Sticker Packs
|
// Standard Sticker Packs
|
||||||
nitroStickerPacks: () => string
|
stickerPacks: () => string
|
||||||
/** Routes for webhook related routes. */
|
/** Routes for webhook related routes. */
|
||||||
webhooks: {
|
webhooks: {
|
||||||
/** Route for managing the original message sent by a webhook. */
|
/** Route for managing the original message sent by a webhook. */
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import type {
|
|||||||
ApplicationCommandPermissionTypes,
|
ApplicationCommandPermissionTypes,
|
||||||
ApplicationCommandTypes,
|
ApplicationCommandTypes,
|
||||||
ApplicationFlags,
|
ApplicationFlags,
|
||||||
|
AttachmentFlags,
|
||||||
AuditLogEvents,
|
AuditLogEvents,
|
||||||
ButtonStyles,
|
ButtonStyles,
|
||||||
ChannelFlags,
|
ChannelFlags,
|
||||||
@@ -27,6 +28,7 @@ import type {
|
|||||||
PickPartial,
|
PickPartial,
|
||||||
PremiumTiers,
|
PremiumTiers,
|
||||||
PremiumTypes,
|
PremiumTypes,
|
||||||
|
RoleFlags,
|
||||||
ScheduledEventEntityType,
|
ScheduledEventEntityType,
|
||||||
ScheduledEventPrivacyLevel,
|
ScheduledEventPrivacyLevel,
|
||||||
ScheduledEventStatus,
|
ScheduledEventStatus,
|
||||||
@@ -76,6 +78,8 @@ export interface DiscordUser {
|
|||||||
email?: string | null
|
email?: string | null
|
||||||
/** the user's banner, or null if unset */
|
/** the user's banner, or null if unset */
|
||||||
banner?: string
|
banner?: string
|
||||||
|
/** the user's avatar decoration, or null if unset */
|
||||||
|
avatar_decoration?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/** https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes */
|
/** https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes */
|
||||||
@@ -91,7 +95,7 @@ export enum OAuth2Scope {
|
|||||||
* Allows your app to update a user's activity
|
* Allows your app to update a user's activity
|
||||||
*
|
*
|
||||||
* @remarks
|
* @remarks
|
||||||
* This scope requires Discord approval to be used
|
* This scope not currently available for apps.
|
||||||
*/
|
*/
|
||||||
ActivitiesWrite = 'activities.write',
|
ActivitiesWrite = 'activities.write',
|
||||||
/** Allows your app to read build data for a user's applications */
|
/** Allows your app to read build data for a user's applications */
|
||||||
@@ -675,6 +679,12 @@ export interface DiscordAttachment {
|
|||||||
width?: number | null
|
width?: number | null
|
||||||
/** whether this attachment is ephemeral. Ephemeral attachments will automatically be removed after a set period of time. Ephemeral attachments on messages are guaranteed to be available as long as the message itself exists. */
|
/** whether this attachment is ephemeral. Ephemeral attachments will automatically be removed after a set period of time. Ephemeral attachments on messages are guaranteed to be available as long as the message itself exists. */
|
||||||
ephemeral?: boolean
|
ephemeral?: boolean
|
||||||
|
/** The duration of the audio file for a voice message */
|
||||||
|
duration_secs?: number
|
||||||
|
/** A base64 encoded bytearray representing a sampled waveform for a voice message */
|
||||||
|
waveform?: string
|
||||||
|
/** Attachment flags combined as a bitfield */
|
||||||
|
flags?: AttachmentFlags
|
||||||
}
|
}
|
||||||
|
|
||||||
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */
|
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */
|
||||||
@@ -800,7 +810,7 @@ export interface DiscordGuild {
|
|||||||
discovery_splash: string | null
|
discovery_splash: string | null
|
||||||
/** Id of the owner */
|
/** Id of the owner */
|
||||||
owner_id: string
|
owner_id: string
|
||||||
/** Total permissions for the user in the guild (excludes overwrites) */
|
/** Total permissions for the user in the guild (excludes overwrites and implicit permissions) */
|
||||||
permissions?: string
|
permissions?: string
|
||||||
/** Id of afk channel */
|
/** Id of afk channel */
|
||||||
afk_channel_id: string | null
|
afk_channel_id: string | null
|
||||||
@@ -851,7 +861,7 @@ export interface DiscordPartialGuild {
|
|||||||
icon: string | null
|
icon: string | null
|
||||||
/** true if the user is the owner of the guild */
|
/** true if the user is the owner of the guild */
|
||||||
owner: boolean
|
owner: boolean
|
||||||
/** total permissions for the user in the guild (excludes overwrites and implicit permissions) */
|
/** Total permissions for the user in the guild (excludes overwrites and implicit permissions) */
|
||||||
permissions: string
|
permissions: string
|
||||||
/** Enabled guild features */
|
/** Enabled guild features */
|
||||||
features: GuildFeatures[]
|
features: GuildFeatures[]
|
||||||
@@ -885,6 +895,8 @@ export interface DiscordRole {
|
|||||||
position: number
|
position: number
|
||||||
/** role unicode emoji */
|
/** role unicode emoji */
|
||||||
unicode_emoji?: string
|
unicode_emoji?: string
|
||||||
|
/** Role flags combined as a bitfield */
|
||||||
|
flags: RoleFlags
|
||||||
}
|
}
|
||||||
|
|
||||||
/** https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure */
|
/** https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure */
|
||||||
@@ -1007,7 +1019,7 @@ export interface DiscordChannel {
|
|||||||
member?: DiscordThreadMember
|
member?: DiscordThreadMember
|
||||||
/** Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
/** Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080 */
|
||||||
default_auto_archive_duration?: number
|
default_auto_archive_duration?: number
|
||||||
/** computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a application command interaction */
|
/** computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on a slash command interaction. This does not include implicit permissions, which may need to be checked separately. */
|
||||||
permissions?: string
|
permissions?: string
|
||||||
/** The flags of the channel */
|
/** The flags of the channel */
|
||||||
flags?: ChannelFlags
|
flags?: ChannelFlags
|
||||||
@@ -1322,12 +1334,26 @@ export interface DiscordChannelMention {
|
|||||||
|
|
||||||
/** https://discord.com/developers/docs/resources/channel#reaction-object */
|
/** https://discord.com/developers/docs/resources/channel#reaction-object */
|
||||||
export interface DiscordReaction {
|
export interface DiscordReaction {
|
||||||
/** Times this emoji has been used to react */
|
/** Total number of times this emoji has been used to react (including super reacts) */
|
||||||
count: number
|
count: number
|
||||||
|
/** Reaction count details object */
|
||||||
|
count_details: DiscordReactionCountDetails
|
||||||
/** Whether the current user reacted using this emoji */
|
/** Whether the current user reacted using this emoji */
|
||||||
me: boolean
|
me: boolean
|
||||||
|
/** Whether the current user super-reacted using this emoji */
|
||||||
|
me_burst: boolean
|
||||||
/** Emoji information */
|
/** Emoji information */
|
||||||
emoji: Partial<DiscordEmoji>
|
emoji: Partial<DiscordEmoji>
|
||||||
|
/** HEX colors used for super reaction */
|
||||||
|
burst_colors: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** https://discord.com/developers/docs/resources/channel#reaction-count-details-object */
|
||||||
|
export interface DiscordReactionCountDetails {
|
||||||
|
/** Count of super reactions */
|
||||||
|
burst: number
|
||||||
|
/** Count of normal reactions */
|
||||||
|
normal: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */
|
/** https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure */
|
||||||
@@ -1533,6 +1559,13 @@ export interface DiscordInteraction {
|
|||||||
/** The guild it was sent from */
|
/** The guild it was sent from */
|
||||||
guild_id?: string
|
guild_id?: string
|
||||||
/** The channel it was sent from */
|
/** The channel it was sent from */
|
||||||
|
channel: Partial<DiscordChannel>
|
||||||
|
/**
|
||||||
|
* The ID of channel it was sent from
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* It is recommended that you begin using this channel field to identify the source channel of the interaction as they may deprecate the existing channel_id field in the future.
|
||||||
|
*/
|
||||||
channel_id?: string
|
channel_id?: string
|
||||||
/** Guild member data for the invoking user, including permissions */
|
/** Guild member data for the invoking user, including permissions */
|
||||||
member?: DiscordInteractionMember
|
member?: DiscordInteractionMember
|
||||||
@@ -1950,6 +1983,12 @@ export interface DiscordOptionalAuditEntryInfo {
|
|||||||
* Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`
|
* Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`
|
||||||
*/
|
*/
|
||||||
type: string
|
type: string
|
||||||
|
/**
|
||||||
|
* The type of integration which performed the action
|
||||||
|
*
|
||||||
|
* Event types: `MEMBER_KICK`, `MEMBER_ROLE_UPDATE`
|
||||||
|
*/
|
||||||
|
integration_type: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DiscordScheduledEvent {
|
export interface DiscordScheduledEvent {
|
||||||
@@ -2819,7 +2858,7 @@ export interface DiscordModifyGuildChannelPositions {
|
|||||||
/** Channel id */
|
/** Channel id */
|
||||||
id: string
|
id: string
|
||||||
/** Sorting position of the channel */
|
/** Sorting position of the channel */
|
||||||
position: number | null
|
position?: number | null
|
||||||
/** Syncs the permission overwrites with the new parent, if moving to a new category */
|
/** Syncs the permission overwrites with the new parent, if moving to a new category */
|
||||||
lock_positions?: boolean | null
|
lock_positions?: boolean | null
|
||||||
/** The new parent ID for the channel that is moved */
|
/** The new parent ID for the channel that is moved */
|
||||||
|
|||||||
@@ -690,7 +690,7 @@ export interface ModifyGuildChannelPositions {
|
|||||||
/** Channel id */
|
/** Channel id */
|
||||||
id: BigString
|
id: BigString
|
||||||
/** Sorting position of the channel */
|
/** Sorting position of the channel */
|
||||||
position: number | null
|
position?: number | null
|
||||||
/** Syncs the permission overwrites with the new parent, if moving to a new category */
|
/** Syncs the permission overwrites with the new parent, if moving to a new category */
|
||||||
lockPositions?: boolean | null
|
lockPositions?: boolean | null
|
||||||
/** The new parent ID for the channel that is moved */
|
/** The new parent ID for the channel that is moved */
|
||||||
|
|||||||
@@ -39,8 +39,23 @@ export enum ChannelFlags {
|
|||||||
None,
|
None,
|
||||||
/** this thread is pinned to the top of its parent `GUILD_FORUM` channel */
|
/** this thread is pinned to the top of its parent `GUILD_FORUM` channel */
|
||||||
Pinned = 1 << 1,
|
Pinned = 1 << 1,
|
||||||
/** Whether a tag is required to be specified when creating a thread in a `GUILD_FORUM` channel. Tags are specified in the `applied_tags` field. */
|
/** Whether a tag is required to be specified when creating a thread in a `GUILD_FORUM` or a GUILD_MEDIA channel. Tags are specified in the `applied_tags` field. */
|
||||||
RequireTag,
|
RequireTag = 1 << 4,
|
||||||
|
/** When set hides the embedded media download options. Available only for media channels. */
|
||||||
|
HideMediaDownloadOptions = 1 << 15,
|
||||||
|
}
|
||||||
|
|
||||||
|
/** https://discord.com/developers/docs/topics/permissions#role-object-role-flags */
|
||||||
|
export enum RoleFlags {
|
||||||
|
None,
|
||||||
|
/** Role can be selected by members in an onboarding prompt */
|
||||||
|
InPrompt = 1 << 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum AttachmentFlags {
|
||||||
|
None,
|
||||||
|
/** This attachment has been edited using the remix feature on mobile */
|
||||||
|
IsRemix = 1 << 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors */
|
/** https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors */
|
||||||
@@ -295,6 +310,8 @@ export enum ChannelTypes {
|
|||||||
GuildDirectory,
|
GuildDirectory,
|
||||||
/** A channel which can only contains threads */
|
/** A channel which can only contains threads */
|
||||||
GuildForum,
|
GuildForum,
|
||||||
|
/** Channel that can only contain threads, similar to GUILD_FORUM channels */
|
||||||
|
GuildMedia,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum OverwriteTypes {
|
export enum OverwriteTypes {
|
||||||
@@ -364,9 +381,9 @@ export enum MessageActivityTypes {
|
|||||||
|
|
||||||
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types */
|
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-types */
|
||||||
export enum StickerTypes {
|
export enum StickerTypes {
|
||||||
/** an official sticker in a pack, part of Nitro or in a removed purchasable pack */
|
/** an official sticker in a pack */
|
||||||
Standard = 1,
|
Standard = 1,
|
||||||
/** a sticker uploaded to a Boosted guild for the guild's members */
|
/** a sticker uploaded to a guild for the guild's members */
|
||||||
Guild,
|
Guild,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,6 +524,14 @@ export enum AuditLogEvents {
|
|||||||
AutoModerationRuleDelete,
|
AutoModerationRuleDelete,
|
||||||
/** Message was blocked by AutoMod according to a rule. */
|
/** Message was blocked by AutoMod according to a rule. */
|
||||||
AutoModerationBlockMessage,
|
AutoModerationBlockMessage,
|
||||||
|
/** Message was flagged by AutoMod */
|
||||||
|
AudoModerationFlagMessage,
|
||||||
|
/** Member was timed out by AutoMod */
|
||||||
|
AutoModerationMemberTimedOut,
|
||||||
|
/** Creator monetization request was created */
|
||||||
|
CreatorMonetizationRequestCreated = 150,
|
||||||
|
/** Creator monetization terms were accepted */
|
||||||
|
CreatorMonetizationTermsAccepted,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ScheduledEventPrivacyLevel {
|
export enum ScheduledEventPrivacyLevel {
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ export function avatarUrl(
|
|||||||
: `https://cdn.discordapp.com/embed/avatars/${discriminator === '0' ? (BigInt(userId) >> BigInt(22)) % BigInt(6) : Number(discriminator) % 5}.png`
|
: `https://cdn.discordapp.com/embed/avatars/${discriminator === '0' ? (BigInt(userId) >> BigInt(22)) % BigInt(6) : Number(discriminator) % 5}.png`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function avatarDecorationUrl(userId: BigString, avatarDecoration: BigString): string {
|
||||||
|
return `https://cdn.discordapp.com/avatar-decorations/${userId}/${
|
||||||
|
typeof avatarDecoration === 'string' ? avatarDecoration : iconBigintToHash(avatarDecoration)
|
||||||
|
}.png`
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a URL to a user's banner stored in the Discord CDN.
|
* Builds a URL to a user's banner stored in the Discord CDN.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user