refactor!: move dirs outside of src/ (#2032)

This commit is contained in:
Skillz4Killz
2022-02-11 04:49:53 -05:00
committed by GitHub
parent 471ef5cb6c
commit 8aaea9f339
594 changed files with 84 additions and 66 deletions
+26
View File
@@ -0,0 +1,26 @@
import type { ImageFormat } from "../../types/misc/imageFormat.ts";
import type { ImageSize } from "../../types/misc/imageSize.ts";
import type { Bot } from "../../bot.ts";
/** The users custom avatar or the default avatar if you don't have a member object. */
export function avatarURL(
bot: Bot,
userId: bigint,
discriminator: number,
options?: {
avatar: bigint | undefined;
size?: ImageSize;
format?: ImageFormat;
},
) {
return options?.avatar
? bot.utils.formatImageURL(
bot.constants.endpoints.USER_AVATAR(
userId,
typeof options?.avatar === "string" ? options.avatar : bot.utils.iconBigintToHash(options?.avatar),
),
options?.size || 128,
options?.format,
)
: bot.constants.endpoints.USER_DEFAULT_AVATAR(Number(discriminator) % 5);
}