3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Fix max stickers and premium tier in !server (#258)

This commit is contained in:
Almeida 2021-09-04 17:16:44 +01:00 committed by GitHub
parent 2d777a03db
commit 535659a2b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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({