3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-21 16:55:03 +00:00

fixed max stickers and premium tier

This commit is contained in:
almeidx 2021-08-24 21:45:30 +01:00
parent 7f2731262d
commit 77df519f3c
No known key found for this signature in database
GPG key ID: 8558FBFF849BD664

View file

@ -1,4 +1,4 @@
import { MessageEmbedOptions, Snowflake } from "discord.js";
import { MessageEmbedOptions, PremiumTier, Snowflake } from "discord.js";
import humanizeDuration from "humanize-duration";
import { GuildPluginData } from "knub";
import moment from "moment-timezone";
@ -19,6 +19,13 @@ import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { UtilityPluginType } from "../types";
import { getGuildPreview } from "./getGuildPreview";
const PremiumTiers: Record<PremiumTier, number> = {
NONE: 0,
TIER_1: 1,
TIER_2: 2,
TIER_3: 3,
};
export async function getServerInfoEmbed(
pluginData: GuildPluginData<UtilityPluginType>,
serverId: string,
@ -179,20 +186,22 @@ export async function getServerInfoEmbed(
}
if (restGuild) {
const premiumTierValue = PremiumTiers[restGuild.premiumTier];
const maxEmojis =
{
0: 50,
1: 100,
2: 150,
3: 250,
}[restGuild.premiumTier] || 50;
}[premiumTierValue] ?? 50;
const maxStickers =
{
0: 0,
1: 15,
2: 30,
3: 60,
}[restGuild.premiumTier] || 0;
}[premiumTierValue] ?? 0;
otherStats.push(`Emojis: **${restGuild.emojis.cache.size}** / ${maxEmojis * 2}`);
otherStats.push(`Stickers: **${restGuild.stickers.cache.size}** / ${maxStickers}`);
@ -202,7 +211,9 @@ export async function getServerInfoEmbed(
}
if (thisServer) {
otherStats.push(`Boosts: **${thisServer.premiumSubscriptionCount ?? 0}** (level ${thisServer.premiumTier})`);
otherStats.push(
`Boosts: **${thisServer.premiumSubscriptionCount ?? 0}** (level ${PremiumTiers[thisServer.premiumTier]})`,
);
}
embed.fields.push({