From ce6ec50ee1cc0a5486c87cb6b25a354ab591c0a5 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Sun, 5 Nov 2023 09:06:53 +1100 Subject: [PATCH] Fix formatting of poll results in JSON file. --- src/commands/poll.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/poll.ts b/src/commands/poll.ts index a657c1d..0b27bf8 100644 --- a/src/commands/poll.ts +++ b/src/commands/poll.ts @@ -37,7 +37,7 @@ export default { writeFileSync(`src/database/polls/pollResults-${msg.id}.json`, JSON.stringify({ map_names: msg.embeds[0].description.split('\n').map(x=>x.slice(3)), votes: msg.reactions.cache.map(x=>x.count) - })); + }, null, 2)); (client.channels.cache.get('516344221452599306') as Discord.TextChannel).send({files: [`src/database/polls/pollResults-${msg.id}.json`]}); msg.edit({embeds: [new client.embed().setColor(client.config.embedColor).setTitle('Voting has ended!').setDescription('The next map will be '+msg.embeds[0].description.split('\n')[msg.reactions.cache.map(x=>x.count).indexOf(Math.max(...msg.reactions.cache.map(x=>x.count)))].slice(3)).setFooter({text: `Poll ended by ${interaction.user.tag}`, iconURL: interaction.member.displayAvatarURL({extension: 'webp', size: 1024})})]});