mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 00:40:07 +00:00
Merge pull request #1846 from some-boi/main
make some function params optional
This commit is contained in:
@@ -6,20 +6,20 @@ import type { Bot } from "../../bot.ts";
|
||||
export function guildIconURL(
|
||||
bot: Bot,
|
||||
id: bigint,
|
||||
options: {
|
||||
icon?: string | bigint;
|
||||
icon: bigint | undefined,
|
||||
options?: {
|
||||
size?: ImageSize;
|
||||
format?: ImageFormat;
|
||||
}
|
||||
) {
|
||||
return options.icon
|
||||
return icon
|
||||
? bot.utils.formatImageURL(
|
||||
bot.constants.endpoints.GUILD_ICON(
|
||||
id,
|
||||
typeof options.icon === "string" ? options.icon : bot.utils.iconBigintToHash(options.icon)
|
||||
typeof icon === "string" ? icon : bot.utils.iconBigintToHash(icon)
|
||||
),
|
||||
options.size || 128,
|
||||
options.format
|
||||
options?.size || 128,
|
||||
options?.format
|
||||
)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
@@ -6,20 +6,20 @@ import type { Bot } from "../../bot.ts";
|
||||
export function guildSplashURL(
|
||||
bot: Bot,
|
||||
id: bigint,
|
||||
options: {
|
||||
splash?: string | bigint;
|
||||
splash: bigint | undefined,
|
||||
options?: {
|
||||
size?: ImageSize;
|
||||
format?: ImageFormat;
|
||||
}
|
||||
) {
|
||||
return options.splash
|
||||
return splash
|
||||
? bot.utils.formatImageURL(
|
||||
bot.constants.endpoints.GUILD_SPLASH(
|
||||
id,
|
||||
typeof options.splash === "string" ? options.splash : bot.utils.iconBigintToHash(options.splash)
|
||||
typeof splash === "string" ? splash : bot.utils.iconBigintToHash(splash)
|
||||
),
|
||||
options.size || 128,
|
||||
options.format
|
||||
options?.size || 128,
|
||||
options?.format
|
||||
)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
@@ -7,20 +7,20 @@ export function avatarURL(
|
||||
bot: Bot,
|
||||
userId: bigint,
|
||||
discriminator: number,
|
||||
options: {
|
||||
avatar?: string | bigint;
|
||||
options?: {
|
||||
avatar: bigint | undefined;
|
||||
size?: ImageSize;
|
||||
format?: ImageFormat;
|
||||
}
|
||||
) {
|
||||
return options.avatar
|
||||
return options?.avatar
|
||||
? bot.utils.formatImageURL(
|
||||
bot.constants.endpoints.USER_AVATAR(
|
||||
userId,
|
||||
typeof options.avatar === "string" ? options.avatar : bot.utils.iconBigintToHash(options.avatar)
|
||||
typeof options?.avatar === "string" ? options.avatar : bot.utils.iconBigintToHash(options?.avatar)
|
||||
),
|
||||
options.size || 128,
|
||||
options.format
|
||||
options?.size || 128,
|
||||
options?.format
|
||||
)
|
||||
: bot.constants.endpoints.USER_DEFAULT_AVATAR(Number(discriminator) % 5);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user