From 7df3b4510c54ef09abe3e66ad45df43eacbcdc8e Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 19 May 2023 23:50:24 +0000 Subject: [PATCH] fix: all imports moved to events/ --- src/commands/debug.ts | 2 +- src/commands/eligible.ts | 2 +- src/commands/help.ts | 6 +----- src/commands/inactive.ts | 2 +- src/commands/ownedtanks.ts | 2 +- src/commands/playerinfo.ts | 0 src/commands/searchplayers.ts | 2 +- src/commands/stats.ts | 2 +- src/commands/tankstats.ts | 2 +- src/commands/verify.ts | 2 +- src/core/blitz/wargamingError.ts | 2 +- src/core/blitzstars/blitzStarsError.ts | 6 +++--- src/index.ts | 8 ++++---- 13 files changed, 17 insertions(+), 21 deletions(-) create mode 100644 src/commands/playerinfo.ts diff --git a/src/commands/debug.ts b/src/commands/debug.ts index 9f1121277..2280c12a0 100644 --- a/src/commands/debug.ts +++ b/src/commands/debug.ts @@ -1,11 +1,11 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import packageJSON from '../../package.json' assert { type: 'json' }; -import { CommandRegistry } from '../behaviors/interactionCreate.js'; import { SKILLED_COLOR } from '../constants/colors.js'; import { tankopedia } from '../core/blitzstars/tankopedia.js'; import cmdName from '../core/interaction/cmdName.js'; import getClientId from '../core/process/getClientId.js'; import { client } from '../index.js'; +import { CommandRegistry } from '../events/interactionCreate.js'; const executionStart = new Date().getTime(); diff --git a/src/commands/eligible.ts b/src/commands/eligible.ts index 55c7c3577..027c7beab 100644 --- a/src/commands/eligible.ts +++ b/src/commands/eligible.ts @@ -1,6 +1,5 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import markdownEscape from 'markdown-escape'; -import { CommandRegistry } from '../behaviors/interactionCreate.js'; import { NEGATIVE_COLOR, POSITIVE_COLOR } from '../constants/colors.js'; import { BlitzServer } from '../constants/servers.js'; import usernameAutocomplete from '../core/autocomplete/username.js'; @@ -11,6 +10,7 @@ import poweredByBlitzStars from '../core/blitzstars/poweredByBlitzStars.js'; import cmdName from '../core/interaction/cmdName.js'; import addServerChoices from '../core/options/addServerChoices.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; +import { CommandRegistry } from '../events/interactionCreate.js'; const CLANS = { sklld: { id: 71559, name: 'Skilled' }, diff --git a/src/commands/help.ts b/src/commands/help.ts index becfdb964..ce2df554e 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -1,13 +1,9 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import discord from '../../discord.json' assert { type: 'json' }; -import { - CommandRegistry, - guildCommands, - publicCommands, -} from '../behaviors/interactionCreate.js'; import { SKILLED_COLOR } from '../constants/colors.js'; import cmdName from '../core/interaction/cmdName.js'; import { client } from '../index.js'; +import { CommandRegistry, guildCommands, publicCommands } from '../events/interactionCreate.js'; export default { inProduction: true, diff --git a/src/commands/inactive.ts b/src/commands/inactive.ts index 7969d166b..f076fcdf4 100644 --- a/src/commands/inactive.ts +++ b/src/commands/inactive.ts @@ -1,6 +1,5 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import markdownEscape from 'markdown-escape'; -import { CommandRegistry } from '../behaviors/interactionCreate.js'; import { NEGATIVE_COLOR, POSITIVE_COLOR } from '../constants/colors.js'; import clanAutocomplete from '../core/autocomplete/clan.js'; import getBlitzClan from '../core/blitz/getBlitzClan.js'; @@ -8,6 +7,7 @@ import getWargamingResponse from '../core/blitz/getWargamingResponse.js'; import cmdName from '../core/interaction/cmdName.js'; import addClanOption from '../core/options/addClanOption.js'; import { args } from '../core/process/args.js'; +import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo } from '../types/accountInfo.js'; import { ClanInfo } from '../types/clanInfo.js'; diff --git a/src/commands/ownedtanks.ts b/src/commands/ownedtanks.ts index 0eb758ed1..d38e7705f 100644 --- a/src/commands/ownedtanks.ts +++ b/src/commands/ownedtanks.ts @@ -1,6 +1,5 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import markdownEscape from 'markdown-escape'; -import { CommandRegistry } from '../behaviors/interactionCreate.js'; import { SKILLED_COLOR } from '../constants/colors.js'; import usernameAutocomplete from '../core/autocomplete/username.js'; import getBlitzAccount from '../core/blitz/getBlitzAccount.js'; @@ -9,6 +8,7 @@ import { TANK_TYPE_EMOJIS, tankopedia } from '../core/blitzstars/tankopedia.js'; import cmdName from '../core/interaction/cmdName.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; import { args } from '../core/process/args.js'; +import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo } from '../types/accountInfo.js'; import { TanksStats } from '../types/tanksStats.js'; import resolveTankName from '../utilities/resolveTankName.js'; diff --git a/src/commands/playerinfo.ts b/src/commands/playerinfo.ts new file mode 100644 index 000000000..e69de29bb diff --git a/src/commands/searchplayers.ts b/src/commands/searchplayers.ts index 2d6a5b2b6..3d44364f6 100644 --- a/src/commands/searchplayers.ts +++ b/src/commands/searchplayers.ts @@ -1,12 +1,12 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import markdownEscape from 'markdown-escape'; -import { CommandRegistry } from '../behaviors/interactionCreate.js'; import { SKILLED_COLOR } from '../constants/colors.js'; import getWargamingResponse from '../core/blitz/getWargamingResponse.js'; import cmdName from '../core/interaction/cmdName.js'; import addServerChoices from '../core/options/addServerChoices.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; import { args } from '../core/process/args.js'; +import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountList } from '../types/accountList.js'; export default { diff --git a/src/commands/stats.ts b/src/commands/stats.ts index 5d99408c3..6b2b18ccb 100644 --- a/src/commands/stats.ts +++ b/src/commands/stats.ts @@ -1,6 +1,5 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import markdownEscape from 'markdown-escape'; -import { CommandRegistry } from '../behaviors/interactionCreate.js'; import { SKILLED_COLOR } from '../constants/colors.js'; import usernameAutocomplete from '../core/autocomplete/username.js'; import getBlitzAccount from '../core/blitz/getBlitzAccount.js'; @@ -12,6 +11,7 @@ import cleanTable from '../core/interaction/cleanTable.js'; import cmdName from '../core/interaction/cmdName.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; import { args } from '../core/process/args.js'; +import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo, AllStats } from '../types/accountInfo.js'; import { BlitzStartsComputedPeriodicStatistics } from '../types/statistics.js'; diff --git a/src/commands/tankstats.ts b/src/commands/tankstats.ts index 7e33641f7..0ed5393cd 100644 --- a/src/commands/tankstats.ts +++ b/src/commands/tankstats.ts @@ -1,6 +1,5 @@ import { SlashCommandBuilder } from 'discord.js'; import markdownEscape from 'markdown-escape'; -import { CommandRegistry } from '../behaviors/interactionCreate.js'; import tanksAutocomplete from '../core/autocomplete/tanks.js'; import usernameAutocomplete from '../core/autocomplete/username.js'; import getBlitzAccount from '../core/blitz/getBlitzAccount.js'; @@ -16,6 +15,7 @@ import sklldEmbed from '../core/interaction/sklldEmbed.js'; import addTankChoices from '../core/options/addTankChoices.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; import { args } from '../core/process/args.js'; +import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo } from '../types/accountInfo.js'; import resolveTankName from '../utilities/resolveTankName.js'; diff --git a/src/commands/verify.ts b/src/commands/verify.ts index 20de24570..90ccbf0f5 100644 --- a/src/commands/verify.ts +++ b/src/commands/verify.ts @@ -1,7 +1,6 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import markdownEscape from 'markdown-escape'; import discord from '../../discord.json' assert { type: 'json' }; -import { CommandRegistry } from '../behaviors/interactionCreate.js'; import { NEGATIVE_COLOR, POSITIVE_COLOR } from '../constants/colors.js'; import usernameAutocomplete from '../core/autocomplete/username.js'; import getBlitzAccount from '../core/blitz/getBlitzAccount.js'; @@ -9,6 +8,7 @@ import getWargamingResponse from '../core/blitz/getWargamingResponse.js'; import cmdName from '../core/interaction/cmdName.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; import { args } from '../core/process/args.js'; +import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo } from '../types/accountInfo.js'; import { PlayerClanData } from '../types/playerClanData.js'; diff --git a/src/core/blitz/wargamingError.ts b/src/core/blitz/wargamingError.ts index eab528da5..a6daae8fb 100644 --- a/src/core/blitz/wargamingError.ts +++ b/src/core/blitz/wargamingError.ts @@ -3,8 +3,8 @@ import { ChatInputCommandInteraction, EmbedBuilder, } from 'discord.js'; -import { handleError } from '../../behaviors/error.js'; import { NEGATIVE_COLOR } from '../../constants/colors.js'; +import { handleError } from '../../events/error.js'; import { client } from '../../index.js'; export default async function wargamingError( diff --git a/src/core/blitzstars/blitzStarsError.ts b/src/core/blitzstars/blitzStarsError.ts index 980a377cc..1278d3bf1 100644 --- a/src/core/blitzstars/blitzStarsError.ts +++ b/src/core/blitzstars/blitzStarsError.ts @@ -3,9 +3,9 @@ import { ChatInputCommandInteraction, EmbedBuilder, } from 'discord.js'; -import { handleError } from '../behaviors/error.js'; -import { NEGATIVE_COLOR } from '../constants/colors.js'; -import { client } from '../index.js'; +import { NEGATIVE_COLOR } from '../../constants/colors.js'; +import { handleError } from '../../events/error.js'; +import { client } from '../../index.js'; export default async function blitzStarsError( interaction: ChatInputCommandInteraction, diff --git a/src/index.ts b/src/index.ts index e399608e4..bd3cf6eee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,9 @@ import { Client, GatewayIntentBits } from 'discord.js'; -import { registerErrorHandlers } from './behaviors/error.js'; -import guildMemberAdd from './behaviors/guildMemberAdd.js'; -import interactionCreate from './behaviors/interactionCreate.js'; -import ready from './behaviors/ready.js'; import { args } from './core/process/args.js'; +import { registerErrorHandlers } from './events/error.js'; +import guildMemberAdd from './events/guildMemberAdd.js'; +import interactionCreate from './events/interactionCreate.js'; +import ready from './events/ready.js'; export const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers],