diff --git a/src/commands/playerAchievements.ts b/src/commands/playerAchievements.ts index ec76f0a0f..1f029216f 100644 --- a/src/commands/playerAchievements.ts +++ b/src/commands/playerAchievements.ts @@ -1,73 +1,80 @@ -import { SlashCommandBuilder } from 'discord.js'; -import { startCase } from 'lodash'; -import markdownEscape from 'markdown-escape'; -import { getAccountAchievements } from '../core/blitz/getAccountAchievements'; -import { getAccountInfo } from '../core/blitz/getAccountInfo'; -import addUsernameChoices from '../core/discord/addUsernameChoices'; -import autocompleteUsername from '../core/discord/autocompleteUsername'; -import embedInfo from '../core/discord/embedInfo'; -import markdownTable, { TableInputEntry } from '../core/discord/markdownTable'; -import resolvePlayerFromCommand from '../core/discord/resolvePlayerFromCommand'; -import { CommandRegistry } from '../events/interactionCreate'; +// _____ _____ _ _ _ _ _____ ____ __ __ ______ ____ _____ _ __ +// |_ _| / ____| | | | /\ | | | | / ____/ __ \| \/ | ____| | _ \ /\ / ____| |/ / +// | | | (___ | |__| | / \ | | | | | | | | | | \ / | |__ | |_) | / \ | | | ' / +// | | \___ \| __ | / /\ \ | | | | | | | | | | |\/| | __| | _ < / /\ \| | | < +// _| |_ ____) | | | |/ ____ \| |____| |____ | |___| |__| | | | | |____ | |_) / ____ \ |____| . \ +// |_____| |_____/|_| |_/_/ \_\______|______| \_____\____/|_| |_|______| |____/_/ \_\_____|_|\_\ -type SortBy = 'name' | 'count'; +// import { SlashCommandBuilder } from 'discord.js'; +// import { startCase } from 'lodash'; +// import markdownEscape from 'markdown-escape'; +// import { getAccountAchievements } from '../core/blitz/getAccountAchievements'; +// import { getAccountInfo } from '../core/blitz/getAccountInfo'; +// import addUsernameChoices from '../core/discord/addUsernameChoices'; +// import autocompleteUsername from '../core/discord/autocompleteUsername'; +// import embedInfo from '../core/discord/embedInfo'; +// import markdownTable, { TableInputEntry } from '../core/discord/markdownTable'; +// import resolvePlayerFromCommand from '../core/discord/resolvePlayerFromCommand'; +// import { CommandRegistry } from '../events/interactionCreate'; -export const playerAchievementsCommand = new Promise( - (resolve) => { - resolve({ - inProduction: true, - inPublic: true, +// type SortBy = 'name' | 'count'; - command: new SlashCommandBuilder() - .setName('player-achievements') - .setDescription("All the player's achievements") - .addStringOption(addUsernameChoices) - .addStringOption((option) => - option - .setName('sort') - .setDescription('What to sort by (default: name)') - .addChoices( - { name: 'By name', value: 'name' satisfies SortBy }, - { name: 'By count', value: 'count' satisfies SortBy }, - ), - ), +// export const playerAchievementsCommand = new Promise( +// (resolve) => { +// resolve({ +// inProduction: true, +// inPublic: true, - async handler(interaction) { - const sortBy = (interaction.options.getString('sort') ?? - 'name') as SortBy; - const account = await resolvePlayerFromCommand(interaction); - const { id, region: region } = account; - const accountInfo = await getAccountInfo(region, id); - const accountsAchievements = await getAccountAchievements(region, id); - const accountAchievements = accountsAchievements; - const compound = { - ...accountAchievements.achievements, - ...accountAchievements.max_series, - }; +// command: new SlashCommandBuilder() +// .setName('player-achievements') +// .setDescription("All the player's achievements") +// .addStringOption(addUsernameChoices) +// .addStringOption((option) => +// option +// .setName('sort') +// .setDescription('What to sort by (default: name)') +// .addChoices( +// { name: 'By name', value: 'name' satisfies SortBy }, +// { name: 'By count', value: 'count' satisfies SortBy }, +// ), +// ), - return embedInfo( - `${markdownEscape(accountInfo.nickname)}'s information`, +// async handler(interaction) { +// const sortBy = (interaction.options.getString('sort') ?? +// 'name') as SortBy; +// const account = await resolvePlayerFromCommand(interaction); +// const { id, region: region } = account; +// const accountInfo = await getAccountInfo(region, id); +// const accountsAchievements = await getAccountAchievements(region, id); +// const accountAchievements = accountsAchievements; +// const compound = { +// ...accountAchievements.achievements, +// ...accountAchievements.max_series, +// }; - markdownTable( - Object.keys(compound) - .filter((achievement) => compound[achievement] > 0) - .sort( - sortBy === 'count' - ? (a, b) => compound[b] - compound[a] - : undefined, - ) - .map( - (achievement) => - [ - startCase(achievement), - compound[achievement], - ] as TableInputEntry, - ), - ), - ); - }, +// return embedInfo( +// `${markdownEscape(accountInfo.nickname)}'s information`, - autocomplete: autocompleteUsername, - }); - }, -); +// markdownTable( +// Object.keys(compound) +// .filter((achievement) => compound[achievement] > 0) +// .sort( +// sortBy === 'count' +// ? (a, b) => compound[b] - compound[a] +// : undefined, +// ) +// .map( +// (achievement) => +// [ +// startCase(achievement), +// compound[achievement], +// ] as TableInputEntry, +// ), +// ), +// ); +// }, + +// autocomplete: autocompleteUsername, +// }); +// }, +// );