mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00
Merge branch 'main' of https://github.com/yuzudev/biscuit into add-n128
This commit is contained in:
commit
dde0d87524
@ -1,8 +1,12 @@
|
|||||||
import type { Model } from "../Base.ts";
|
import type { Model } from "../Base.ts";
|
||||||
import type { Session } from "../../session/Session.ts";
|
import type { Session } from "../../session/Session.ts";
|
||||||
import type { DiscordGuild, GuildFeatures } from "../../vendor/external.ts";
|
import type { DiscordGuild } from "../../vendor/external.ts";
|
||||||
|
import type { ImageFormat, ImageSize } from "../../util/shared/images.ts";
|
||||||
|
import { formatImageUrl } from "../../util/shared/images.ts";
|
||||||
|
import { iconBigintToHash, iconHashToBigInt } from "../../util/hash.ts";
|
||||||
|
import { GuildFeatures } from "../../vendor/external.ts";
|
||||||
import { Snowflake } from "../../util/Snowflake.ts";
|
import { Snowflake } from "../../util/Snowflake.ts";
|
||||||
import { iconHashToBigInt } from "../../util/hash.ts";
|
import * as Routes from "../../util/Routes.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for {@link Guild} and {@link AnonymousGuild}
|
* Class for {@link Guild} and {@link AnonymousGuild}
|
||||||
@ -33,6 +37,24 @@ export abstract class BaseGuild implements Model {
|
|||||||
return new Date(this.createdTimestamp);
|
return new Date(this.createdTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get partnered() {
|
||||||
|
return this.features.includes(GuildFeatures.Partnered);
|
||||||
|
}
|
||||||
|
|
||||||
|
get verified() {
|
||||||
|
return this.features.includes(GuildFeatures.Verified);
|
||||||
|
}
|
||||||
|
|
||||||
|
iconUrl(options: { size?: ImageSize; format?: ImageFormat } = { size: 128 }) {
|
||||||
|
if (this.iconHash) {
|
||||||
|
return formatImageUrl(
|
||||||
|
Routes.GUILD_BANNER(this.id, iconBigintToHash(this.iconHash)),
|
||||||
|
options.size,
|
||||||
|
options.format,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
toString() {
|
toString() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
@ -23,3 +23,7 @@ export function GUILD_BANNER(guildId: Snowflake, icon: string) {
|
|||||||
export function GUILD_SPLASH(guildId: Snowflake, icon: string) {
|
export function GUILD_SPLASH(guildId: Snowflake, icon: string) {
|
||||||
return `${Endpoints.CDN_URL}/splashes/${guildId}/${icon}`;
|
return `${Endpoints.CDN_URL}/splashes/${guildId}/${icon}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function GUILD_ICON(guildId: Snowflake, icon: string) {
|
||||||
|
return `${Endpoints.CDN_URL}/icons/${guildId}/${icon}`;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user