0
0
Fork 0

Add helper method for creating the field's title

This commit is contained in:
Oliver-Akins 2021-08-30 16:54:43 -06:00
parent 62285d4492
commit 108fd65487

View file

@ -11,6 +11,26 @@ export default {
let { guild_id: gID } = request.params; let { guild_id: gID } = request.params;
let wh = db[gID].webhook; let wh = db[gID].webhook;
function generateFieldTitle(index: number, quote: quote): string {
// Change the name based on if the quote won or not
if (quote.win_streak > 0) {
let name = `👑 Quote ${index + 1}:`;
if (config.guilds[gID].show_win_streak ?? true) {
name += ` (Streak: ${quote.win_streak})`;
};
return name;
}
else {
return `Quote ${index + 1}:`;
};
};
// Create the very first quote bracket // Create the very first quote bracket
let quotes: quote[]; let quotes: quote[];
if (!db[gID].bracket.msg) { if (!db[gID].bracket.msg) {