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

Update supporters formatting in !about

This commit is contained in:
Dragory 2021-08-20 20:43:08 +03:00
parent dd22745ae0
commit d57d563761
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -7,6 +7,7 @@ import { getCurrentUptime } from "../../../uptime";
import { multiSorter, resolveMember, sorter } from "../../../utils";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { utilityCmd } from "../types";
import { shuffle } from "lodash";
export const AboutCmd = utilityCmd({
trigger: "about",
@ -80,17 +81,19 @@ export const AboutCmd = utilityCmd({
};
const supporters = await pluginData.state.supporters.getAll();
supporters.sort(
multiSorter([
[r => r.amount, "DESC"],
[r => r.name.toLowerCase(), "ASC"],
]),
);
const shuffledSupporters = shuffle(supporters);
if (supporters.length) {
const formattedSupporters = shuffledSupporters
// Bold every other supporter to make them easy to recognize from each other
.map((s, i) => (i % 2 === 0 ? `**${s.name}**` : `__${s.name}__`))
.join(" ");
aboutContent.embeds![0].fields!.push({
name: "Zeppelin supporters 🎉",
value: supporters.map(s => `**${s.name}** ${s.amount ? `${s.amount}€/mo` : ""}`.trim()).join("\n"),
value:
"These amazing people have supported Zeppelin development by pledging on [Patreon](https://www.patreon.com/zeppelinbot):\n\n" +
formattedSupporters,
inline: false,
});
}