mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
feat: channel rest types
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { BigString, DiscordFollowedChannel } from '@discordeno/types'
|
||||
import type { BigString, DiscordFollowedChannel, DiscordFollowAnnouncementChannel } from '@discordeno/types'
|
||||
import type { RestManager } from '../../../restManager.js'
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ export async function followAnnouncementChannel (
|
||||
rest.constants.routes.CHANNEL_FOLLOW(sourceChannelId),
|
||||
{
|
||||
webhook_channel_id: targetChannelId
|
||||
}
|
||||
} as DiscordFollowAnnouncementChannel
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
BigString,
|
||||
DiscordEditChannelPermissionOverridesOptions,
|
||||
OverwriteReadable,
|
||||
WithReason
|
||||
} from '@discordeno/types'
|
||||
@@ -36,7 +37,7 @@ export async function editChannelPermissionOverrides (
|
||||
deny: options.deny ? calculateBits(options.deny) : '0',
|
||||
type: options.type,
|
||||
reason: options.reason
|
||||
}
|
||||
} as DiscordEditChannelPermissionOverridesOptions
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BigString } from '@discordeno/types'
|
||||
import type { BigString, DiscordModifyGuildChannelPositions } from '@discordeno/types'
|
||||
import type { RestManager } from '../../restManager.js'
|
||||
|
||||
export const swapChannels = editChannelPositions
|
||||
@@ -31,22 +31,22 @@ export async function editChannelPositions (
|
||||
'PATCH',
|
||||
rest.constants.routes.GUILD_CHANNELS(guildId),
|
||||
channelPositions.map((channelPosition) => ({
|
||||
id: channelPosition.id,
|
||||
id: channelPosition.id.toString(),
|
||||
position: channelPosition.position,
|
||||
lock_positions: channelPosition.lockPositions,
|
||||
parent_id: channelPosition.parentId
|
||||
}))
|
||||
parent_id: channelPosition.parentId?.toString()
|
||||
})) as DiscordModifyGuildChannelPositions[]
|
||||
)
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
|
||||
export interface ModifyGuildChannelPositions {
|
||||
/** Channel id */
|
||||
id: string
|
||||
id: BigString
|
||||
/** Sorting position of the channel */
|
||||
position: number | null
|
||||
/** Syncs the permission overwrites with the new parent, if moving to a new category */
|
||||
lockPositions?: boolean | null
|
||||
/** The new parent ID for the channel that is moved */
|
||||
parentId?: string | null
|
||||
parentId?: BigString | null
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import type {
|
||||
AllowedMentions,
|
||||
BigString,
|
||||
DiscordChannel,
|
||||
DiscordCreateForumPostWithMessage,
|
||||
FileContent,
|
||||
MessageComponents,
|
||||
SnakeToCamelCaseNested,
|
||||
@@ -60,7 +61,7 @@ export async function createForumThread (
|
||||
components: options.components?.map((component) =>
|
||||
rest.transformers.reverse.component(rest, component)
|
||||
)
|
||||
}
|
||||
} as DiscordCreateForumPostWithMessage
|
||||
)
|
||||
|
||||
return snakeToCamelCaseNested(result)
|
||||
|
||||
@@ -2948,3 +2948,46 @@ export interface DiscordStartThreadWithoutMessage {
|
||||
/** whether non-moderators can add other non-moderators to a thread; only available when creating a private thread */
|
||||
invitable?: boolean
|
||||
}
|
||||
|
||||
export interface CreateForumPostWithMessage {
|
||||
/** 1-100 character thread name */
|
||||
name: string
|
||||
/** Duration in minutes to automatically archive the thread after recent activity */
|
||||
auto_archive_duration: 60 | 1440 | 4320 | 10080
|
||||
/** Amount of seconds a user has to wait before sending another message (0-21600) */
|
||||
rate_limit_per_user?: number | null
|
||||
/** The message contents (up to 2000 characters) */
|
||||
content?: string
|
||||
/** Embedded `rich` content (up to 6000 characters) */
|
||||
embeds?: DiscordEmbed[]
|
||||
/** Allowed mentions for the message */
|
||||
allowed_mentions?: DiscordAllowedMentions
|
||||
/** The components you would like to have sent in this message */
|
||||
components?: DiscordMessageComponents
|
||||
}
|
||||
|
||||
export interface DiscordFollowAnnouncementChannel {
|
||||
/** The id of the channel to send announcements to. */
|
||||
webhook_channel_id: string
|
||||
}
|
||||
|
||||
export interface DiscordEditChannelPermissionOverridesOptions {
|
||||
/** Permission bit set */
|
||||
allow: string
|
||||
/** Permission bit set */
|
||||
deny: string
|
||||
/** Either 0 (role) or 1 (member) */
|
||||
type: OverwriteTypes
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
|
||||
export interface DiscordModifyGuildChannelPositions {
|
||||
/** Channel id */
|
||||
id: string
|
||||
/** Sorting position of the channel */
|
||||
position: number | null
|
||||
/** Syncs the permission overwrites with the new parent, if moving to a new category */
|
||||
lock_positions?: boolean | null
|
||||
/** The new parent ID for the channel that is moved */
|
||||
parent_id?: string | null
|
||||
}
|
||||
Reference in New Issue
Block a user