mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
Update supporters formatting in !about
This commit is contained in:
parent
dd22745ae0
commit
d57d563761
1 changed files with 10 additions and 7 deletions
|
@ -7,6 +7,7 @@ import { getCurrentUptime } from "../../../uptime";
|
||||||
import { multiSorter, resolveMember, sorter } from "../../../utils";
|
import { multiSorter, resolveMember, sorter } from "../../../utils";
|
||||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||||
import { utilityCmd } from "../types";
|
import { utilityCmd } from "../types";
|
||||||
|
import { shuffle } from "lodash";
|
||||||
|
|
||||||
export const AboutCmd = utilityCmd({
|
export const AboutCmd = utilityCmd({
|
||||||
trigger: "about",
|
trigger: "about",
|
||||||
|
@ -80,17 +81,19 @@ export const AboutCmd = utilityCmd({
|
||||||
};
|
};
|
||||||
|
|
||||||
const supporters = await pluginData.state.supporters.getAll();
|
const supporters = await pluginData.state.supporters.getAll();
|
||||||
supporters.sort(
|
const shuffledSupporters = shuffle(supporters);
|
||||||
multiSorter([
|
|
||||||
[r => r.amount, "DESC"],
|
|
||||||
[r => r.name.toLowerCase(), "ASC"],
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (supporters.length) {
|
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({
|
aboutContent.embeds![0].fields!.push({
|
||||||
name: "Zeppelin supporters 🎉",
|
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,
|
inline: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue