tournament-helper-bot/commands/events/view_events.js

22 lines
1.1 KiB
JavaScript

const { SlashCommandBuilder, MessageFlags, EmbedBuilder } = require('discord.js');
const { Tournament } = require("../../data_objects/tournament.js");
const { tetrioRanks } = require("../../data_objects/tetrio_ranks.js");
const { xhr } = require("../../utils.js");
const { tournaments, blacklist, whitelist } = require("../../index.js");
module.exports = {
data: new SlashCommandBuilder()
.setName('view_events')
.setDescription('Посмотреть, за какими событиями бот сейчас наблюдает'),
async execute(interaction) {
console.log(tournaments);
const tournamentsEmbed = new EmbedBuilder()
.setColor(0x0000FF)
.setTitle(`Турниров: ${tournaments.size}`)
tournaments.forEach((value, key, map) => {
tournamentsEmbed.addFields({ name: `${key}: ${value.title}`, value: `Участников: ${value.participants.length}\n\`${value.participants.map((element) => `${element.username.padEnd(18)}${Intl.NumberFormat("ru-RU", {minimumFractionDigits: 2, maximumFractionDigits: 2,}).format(element.tr)} TR\n`)}\`` })
});
interaction.reply({ embeds: [tournamentsEmbed] });
},
};