mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 11:17:05 +02:00
feat: cleaned discord
This commit is contained in:
1 parent
169588a211
commit
01ed20941d
30 files changed
+93
-121
No files matched your search
+6
-4
@@ -1,13 +1,15 @@
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import addPeriodSubCommands from './addPeriodSubCommands.js';
|
||||
import addTankChoices from './addTankChoices.js';
|
||||
import addUsernameOption from './addUsernameOption.js';
|
||||
import addUsernameChoices from './addUsernameChoices.js';
|
||||
|
||||
export default function addStatsSubCommandGroups(option: SlashCommandBuilder) {
|
||||
export default function addStatTypeSubCommandGroups(
|
||||
option: SlashCommandBuilder,
|
||||
) {
|
||||
return option
|
||||
.addSubcommandGroup((option) =>
|
||||
addPeriodSubCommands(option, (option) =>
|
||||
option.addStringOption(addUsernameOption),
|
||||
option.addStringOption(addUsernameChoices),
|
||||
)
|
||||
.setName('player')
|
||||
.setDescription("Player's statistics"),
|
||||
@@ -16,7 +18,7 @@ export default function addStatsSubCommandGroups(option: SlashCommandBuilder) {
|
||||
addPeriodSubCommands(option, (option) =>
|
||||
option
|
||||
.addStringOption(addTankChoices)
|
||||
.addStringOption(addUsernameOption),
|
||||
.addStringOption(addUsernameChoices),
|
||||
)
|
||||
.setName('tank')
|
||||
.setDescription("Tank's statistics"),
|
||||
@@ -1,6 +1,6 @@
|
||||
import { SlashCommandStringOption } from 'discord.js';
|
||||
|
||||
export default function addUsernameOption(option: SlashCommandStringOption) {
|
||||
export default function addUsernameChoices(option: SlashCommandStringOption) {
|
||||
return option
|
||||
.setName('username')
|
||||
.setDescription(
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import { BLITZ_SERVERS } from '../../constants/servers.js';
|
||||
import listClans from '../blitz/listClans.js';
|
||||
|
||||
export default async function clanAutocomplete(
|
||||
export default async function autocompleteClan(
|
||||
interaction: AutocompleteInteraction<CacheType>,
|
||||
) {
|
||||
const focusedOption = interaction.options.getFocused(true);
|
||||
@@ -7,7 +7,7 @@ import { go } from 'fuzzysort';
|
||||
import resolveTankName from '../blitz/resolveTankName.js';
|
||||
import { TANKS } from '../blitz/tankopedia.js';
|
||||
|
||||
export default async function tanksAutocomplete(
|
||||
export default async function autocompleteTanks(
|
||||
interaction: AutocompleteInteraction<CacheType>,
|
||||
) {
|
||||
const focusedOption = interaction.options.getFocused(true);
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import { BLITZ_SERVERS } from '../../constants/servers.js';
|
||||
import listPlayers from '../blitz/listPlayers.js';
|
||||
|
||||
export default async function usernameAutocomplete(
|
||||
export default async function autocompleteUsername(
|
||||
interaction: AutocompleteInteraction<CacheType>,
|
||||
) {
|
||||
const focusedOption = interaction.options.getFocused(true);
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { ACCENT_COLOR } from '../../constants/colors.js';
|
||||
|
||||
export default function infoEmbed(title: string, description: string) {
|
||||
export default function embedInfo(title: string, description: string) {
|
||||
return new EmbedBuilder()
|
||||
.setColor(ACCENT_COLOR)
|
||||
.setTitle(title)
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { NEGATIVE_COLOR } from '../../constants/colors.js';
|
||||
|
||||
export default function negativeEmbed(title: string, description: string) {
|
||||
export default function embedNegative(title: string, description: string) {
|
||||
return new EmbedBuilder()
|
||||
.setColor(NEGATIVE_COLOR)
|
||||
.setTitle(title)
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { POSITIVE_COLOR } from '../../constants/colors.js';
|
||||
|
||||
export default function positiveEmbed(title: string, description: string) {
|
||||
export default function embedPositive(title: string, description: string) {
|
||||
return new EmbedBuilder()
|
||||
.setColor(POSITIVE_COLOR)
|
||||
.setTitle(title)
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
import { WARNING_COLOR } from '../../constants/colors.js';
|
||||
|
||||
export default function warningEmbed(title: string, description: string) {
|
||||
export default function embedWarning(title: string, description: string) {
|
||||
return new EmbedBuilder()
|
||||
.setColor(WARNING_COLOR)
|
||||
.setTitle(title)
|
||||
@@ -1,12 +0,0 @@
|
||||
import { ButtonBuilder, ButtonStyle } from 'discord.js';
|
||||
import { BlitzServer } from '../../constants/servers.js';
|
||||
|
||||
export default function fullBlitzStarsStats(
|
||||
server: BlitzServer,
|
||||
username: string,
|
||||
) {
|
||||
return new ButtonBuilder()
|
||||
.setLabel('View on BlitzStars')
|
||||
.setURL(`https://www.blitzstars.com/player/${server}/${username}`)
|
||||
.setStyle(ButtonStyle.Link);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { CacheType, ChatInputCommandInteraction } from 'discord.js';
|
||||
|
||||
export default function generateCustomId(
|
||||
interaction: ChatInputCommandInteraction<CacheType>,
|
||||
) {
|
||||
return `${interaction.commandName}/${
|
||||
interaction.options.getSubcommandGroup() ?? ''
|
||||
}/${interaction.options.getSubcommand() ?? ''}`;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
export type TableInputEntry = [string, string | number] | [];
|
||||
export type TableInput = TableInputEntry[];
|
||||
|
||||
export default function cleanTable(input: TableInput) {
|
||||
export default function markdownTable(input: TableInput) {
|
||||
return input
|
||||
.filter((array) => array[1] !== undefined)
|
||||
.map((array) => (array.length === 0 ? '' : `**${array[0]}**: ${array[1]}`))
|
||||
@@ -1,6 +0,0 @@
|
||||
import negativeEmbed from './negativeEmbed.js';
|
||||
|
||||
export const noMember = negativeEmbed(
|
||||
'User of command is not a member',
|
||||
'Discord claims that the user of this command does not have an account... strange!',
|
||||
);
|
||||
@@ -1,6 +0,0 @@
|
||||
import negativeEmbed from './negativeEmbed.js';
|
||||
|
||||
export const notTrackedByBlitzStars = negativeEmbed(
|
||||
'No data to display',
|
||||
'Player is not tracked by BlitzStars.',
|
||||
);
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ButtonBuilder, ButtonStyle } from 'discord.js';
|
||||
|
||||
// TODO: ADD THIS AGAIN IMMEDIATELY
|
||||
export const supportBlitzStars = new ButtonBuilder()
|
||||
.setLabel('Support BlitzStars')
|
||||
.setURL('https://www.blitzstars.com/supporters')
|
||||
|
||||
Reference in new issue
Block a user