mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
fix: types for guild stuff for rest
This commit is contained in:
@@ -3,7 +3,8 @@ import type {
|
||||
DiscordGuild,
|
||||
ExplicitContentFilterLevels,
|
||||
SystemChannelFlags,
|
||||
VerificationLevels
|
||||
VerificationLevels,
|
||||
DiscordCreateGuild
|
||||
} from '@discordeno/types'
|
||||
import type { RestManager } from '../../restManager.js'
|
||||
import type { Channel } from '../../transformers/channel.js'
|
||||
@@ -44,7 +45,7 @@ export async function createGuild (
|
||||
system_channel_flags: options.systemChannelFlags,
|
||||
system_channel_id: options.systemChannelId,
|
||||
verification_level: options.verificationLevel
|
||||
}
|
||||
} as DiscordCreateGuild
|
||||
)
|
||||
|
||||
return rest.transformers.guild(rest, { guild: result, shardId: 0 })
|
||||
|
||||
@@ -5,7 +5,8 @@ import type {
|
||||
ExplicitContentFilterLevels,
|
||||
GuildFeatures,
|
||||
SystemChannelFlags,
|
||||
VerificationLevels
|
||||
VerificationLevels,
|
||||
DiscordModifyGuild
|
||||
} from '@discordeno/types'
|
||||
import { urlToBase64 } from '@discordeno/utils'
|
||||
import type { RestManager } from '../../restManager.js'
|
||||
@@ -81,7 +82,7 @@ export async function editGuild (
|
||||
preferred_locale: options.preferredLocale,
|
||||
features: options.features,
|
||||
premium_progress_bar_enabled: options.premiumProgressBarEnabled
|
||||
}
|
||||
} as DiscordModifyGuild
|
||||
)
|
||||
|
||||
return rest.transformers.guild(rest, { guild: result, shardId })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BigString, MfaLevels } from '@discordeno/types'
|
||||
import type { BigString, MfaLevels,DiscordEditGuildMFALevel } from '@discordeno/types'
|
||||
import type { RestManager } from '../../restManager.js'
|
||||
|
||||
/** Modify a guild's MFA level. Requires guild ownership. */
|
||||
@@ -12,6 +12,6 @@ export async function editGuildMfaLevel (
|
||||
rest,
|
||||
'POST',
|
||||
rest.constants.routes.GUILD_MFA_LEVEL(guildId),
|
||||
{ level: mfaLevel, reason }
|
||||
{ level: mfaLevel, reason } as DiscordEditGuildMFALevel
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BigString, DiscordWelcomeScreen } from '@discordeno/types'
|
||||
import type { BigString, DiscordWelcomeScreen, DiscordModifyGuildWelcomeScreen } from '@discordeno/types'
|
||||
import type { RestManager } from '../../restManager.js'
|
||||
import type { WelcomeScreen } from '../../transformers/welcomeScreen.js'
|
||||
|
||||
@@ -35,7 +35,7 @@ export async function editWelcomeScreen (
|
||||
emoji_name: welcomeScreen.emojiName
|
||||
})),
|
||||
description: options.description
|
||||
}
|
||||
} as DiscordModifyGuildWelcomeScreen
|
||||
)
|
||||
|
||||
return rest.transformers.welcomeScreen(rest, result)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BigString } from '@discordeno/types'
|
||||
import type { BigString, DiscordEditOwnVoiceState, DiscordEditUserVoiceState } from '@discordeno/types'
|
||||
import type { RestManager } from '../../../restManager.js'
|
||||
|
||||
export const updateBotVoiceState = editOwnVoiceState
|
||||
@@ -36,7 +36,7 @@ export async function editOwnVoiceState (
|
||||
request_to_speak_timestamp: options.requestToSpeakTimestamp
|
||||
? new Date(options.requestToSpeakTimestamp).toISOString()
|
||||
: options.requestToSpeakTimestamp
|
||||
}
|
||||
} as DiscordEditOwnVoiceState
|
||||
)
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export async function editUserVoiceState (
|
||||
channel_id: options.channelId,
|
||||
suppress: options.suppress,
|
||||
user_id: options.userId
|
||||
}
|
||||
} as DiscordEditUserVoiceState
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BigString, DiscordGuildWidgetSettings } from '@discordeno/types'
|
||||
import type { BigString, DiscordGuildWidgetSettings, DiscordEditGuildWidgetSettings } from '@discordeno/types'
|
||||
import type { RestManager } from '../../../restManager.js'
|
||||
import type { GuildWidgetSettings } from '../../../transformers/widgetSettings.js'
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function editWidgetSettings (
|
||||
{
|
||||
enabled,
|
||||
channel_id: channelId
|
||||
}
|
||||
} as DiscordEditGuildWidgetSettings
|
||||
)
|
||||
|
||||
return rest.transformers.widgetSettings(rest, result)
|
||||
|
||||
@@ -2814,4 +2814,112 @@ export interface DiscordCreateChannelInvite {
|
||||
target_user_id?: string
|
||||
/** The id of the embedded application to open for this invite, required if `target_type` is 2, the application must have the `EMBEDDED` flag */
|
||||
target_application_id?: string
|
||||
}
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#update-current-user-voice-state */
|
||||
export interface DiscordEditOwnVoiceState {
|
||||
/** The id of the channel the user is currently in */
|
||||
channel_id: string
|
||||
/** Toggles the user's suppress state */
|
||||
suppress?: boolean
|
||||
/** Sets the user's request to speak */
|
||||
request_to_speak_timestamp?: number | null
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#update-user-voice-state */
|
||||
export interface DiscordEditUserVoiceState {
|
||||
/** The id of the channel the user is currently in */
|
||||
channel_id: string
|
||||
/** Toggles the user's suppress state */
|
||||
suppress?: boolean
|
||||
/** The user id to target */
|
||||
user_id: string
|
||||
}
|
||||
|
||||
export interface DiscordEditGuildWidgetSettings {
|
||||
/** Whether or not the widget is enabled. */
|
||||
enabled: boolean
|
||||
/** The channel id if any for this widget. */
|
||||
channel_id?: string | null
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#create-guild */
|
||||
export interface DiscordCreateGuild {
|
||||
/** Name of the guild (1-100 characters) */
|
||||
name: string
|
||||
/** Base64 128x128 image for the guild icon */
|
||||
icon?: string
|
||||
/** Verification level */
|
||||
verification_level?: VerificationLevels
|
||||
/** Default message notification level */
|
||||
default_message_notifications?: DefaultMessageNotificationLevels
|
||||
/** Explicit content filter level */
|
||||
explicit_content_filter?: ExplicitContentFilterLevels
|
||||
/** New guild roles (first role is the everyone role) */
|
||||
roles?: Role[]
|
||||
/** New guild's channels */
|
||||
channels?: Array<Partial<Channel>>
|
||||
/** Id for afk channel */
|
||||
afk_channel_id?: string
|
||||
/** Afk timeout in seconds */
|
||||
afk_timeout?: number
|
||||
/** The id of the channel where guild notices such as welcome messages and boost events are posted */
|
||||
system_channel_id?: string
|
||||
/** System channel flags */
|
||||
system_channel_flags?: SystemChannelFlags
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
||||
export interface DiscordModifyGuild {
|
||||
/** Guild name */
|
||||
name?: string
|
||||
/** Verification level */
|
||||
verification_level?: VerificationLevels | null
|
||||
/** Default message notification filter level */
|
||||
default_message_notifications?: DefaultMessageNotificationLevels | null
|
||||
/** Explicit content filter level */
|
||||
explicit_content_filter?: ExplicitContentFilterLevels | null
|
||||
/** Id for afk channel */
|
||||
afk_channel_id?: string | null
|
||||
/** Afk timeout in seconds */
|
||||
afk_timeout?: number
|
||||
/** Base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has the `ANIMATED_ICON` feature) */
|
||||
icon?: string | null
|
||||
/** User id to transfer guild ownership to (must be owner) */
|
||||
owner_id?: string
|
||||
/** Base64 16:9 png/jpeg image for the guild splash (when the server has `INVITE_SPLASH` feature) */
|
||||
splash?: string | null
|
||||
/** Base64 16:9 png/jpeg image for the guild discovery spash (when the server has the `DISCOVERABLE` feature) */
|
||||
discovery_splash?: string | null
|
||||
/** Base64 16:9 png/jpeg image for the guild banner (when the server has BANNER feature) */
|
||||
banner?: string | null
|
||||
/** The id of the channel where guild notices such as welcome messages and boost events are posted */
|
||||
system_channel_id?: string | null
|
||||
/** System channel flags */
|
||||
system_channel_flags?: SystemChannelFlags
|
||||
/** The id of the channel where Community guilds display rules and/or guidelines */
|
||||
rules_channel_id?: string | null
|
||||
/** The id of the channel where admins and moderators of Community guilds receive notices from Discord */
|
||||
public_updates_channel_id?: string | null
|
||||
/** The preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US" */
|
||||
preferred_locale?: string | null
|
||||
/** Enabled guild features */
|
||||
features?: GuildFeatures[]
|
||||
/** Whether the guild's boost progress bar should be enabled */
|
||||
premium_progress_bar_enabled?: boolean
|
||||
}
|
||||
|
||||
export interface DiscordEditGuildMFALevel {
|
||||
/** The level to set for the guilds mfa level. */
|
||||
level: MfaLevels
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
|
||||
export interface DiscordModifyGuildWelcomeScreen {
|
||||
/** Whether the welcome screen is enabled */
|
||||
enabled?: boolean | null
|
||||
/** Channels linked in the welcome screen and their display options */
|
||||
welcome_screen?: DiscordWelcomeScreenChannel[] | null
|
||||
/** The server description to show in the welcome screen */
|
||||
description?: string | null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user