From 3a23a3f8c4bff5e67a1c4fa24f02a4e1321b93d8 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Thu, 8 Jun 2023 00:39:42 +0000 Subject: [PATCH 01/10] feat: simplified discord token and wargaming application id fetching --- src/commands/eligible.ts | 4 ++-- src/commands/inactive.tsx | 10 +++++----- src/commands/ownedtanks.tsx | 6 +++--- src/commands/playerachievements.ts | 6 +++--- src/commands/playerinfo.ts | 4 ++-- src/commands/searchclans.ts | 4 ++-- src/commands/searchplayers.ts | 8 ++++---- src/commands/stats.tsx | 6 +++--- src/commands/tankstats.tsx | 4 ++-- src/commands/today.tsx | 6 +++--- src/commands/verify.ts | 6 +++--- src/core/blitz/getTankStats.ts | 4 ++-- src/core/blitz/listAccountsPanServer.ts | 8 ++++---- src/core/blitz/listClansPanServer.ts | 8 ++++---- src/core/process/args.ts | 5 ++++- src/events/interactionCreate.ts | 4 ++-- src/index.ts | 4 ++-- 17 files changed, 50 insertions(+), 47 deletions(-) diff --git a/src/commands/eligible.ts b/src/commands/eligible.ts index f4091a0b3..934f80c1b 100644 --- a/src/commands/eligible.ts +++ b/src/commands/eligible.ts @@ -13,7 +13,7 @@ import cmdName from '../core/interaction/cmdName.js'; import negativeEmbed from '../core/interaction/negativeEmbed.js'; import positiveEmbed from '../core/interaction/positiveEmbed.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo } from '../types/accountInfo.js'; @@ -51,7 +51,7 @@ export default { const clan = interaction.options.getString('clan') as SkilledClan; const { id, server } = await getBlitzAccount(interaction); const accountInfo = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/info/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/account/info/?application_id=${wargamingApplicationId}&account_id=${id}`, ); const problems: TableInput = []; const title = `${accountInfo[id].nickname}'s eligibility for ${SKILLED_CLANS[clan]}`; diff --git a/src/commands/inactive.tsx b/src/commands/inactive.tsx index 8d4541ee5..ddca68934 100644 --- a/src/commands/inactive.tsx +++ b/src/commands/inactive.tsx @@ -10,7 +10,7 @@ import getBlitzClan from '../core/blitz/getBlitzClan.js'; import getWargamingResponse from '../core/blitz/getWargamingResponse.js'; import cmdName from '../core/interaction/cmdName.js'; import addClanChoices from '../core/options/addClanChoices.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import render from '../core/ui/render.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo } from '../types/accountInfo.js'; @@ -44,14 +44,14 @@ export default { const time = new Date().getTime() / 1000; const clanData = ( await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/clans/info/?application_id=${args['wargaming-application-id']}&clan_id=${id}`, + `https://api.wotblitz.${server}/wotb/clans/info/?application_id=${wargamingApplicationId}&clan_id=${id}`, ) )[id]; const memberIds = clanData.members_ids; const accounts = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/info/?application_id=${ - args['wargaming-application-id'] - }&account_id=${memberIds.join(',')}`, + `https://api.wotblitz.${server}/wotb/account/info/?application_id=${wargamingApplicationId}&account_id=${memberIds.join( + ',', + )}`, ); const inactive = memberIds .map((memberId) => { diff --git a/src/commands/ownedtanks.tsx b/src/commands/ownedtanks.tsx index 5c98f039e..c8af38ea8 100644 --- a/src/commands/ownedtanks.tsx +++ b/src/commands/ownedtanks.tsx @@ -12,7 +12,7 @@ import getWargamingResponse from '../core/blitz/getWargamingResponse.js'; import { TIER_ROMAN_NUMERALS, tankopedia } from '../core/blitz/tankopedia.js'; import cmdName from '../core/interaction/cmdName.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import render from '../core/ui/render.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo } from '../types/accountInfo.js'; @@ -62,14 +62,14 @@ export default { const account = await getBlitzAccount(interaction); const { id, server } = account; const accountInfo = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/info/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/account/info/?application_id=${wargamingApplicationId}&account_id=${id}`, ); const tankStats = await getTankStats(interaction, server, id); const tanks = tankStats .map((tankData) => tankopedia[tankData.tank_id]) .filter((tank) => tank?.tier === tier); const clanData = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${args['wargaming-application-id']}&account_id=${id}&extra=clan`, + `https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${wargamingApplicationId}&account_id=${id}&extra=clan`, ); console.time('ownedtanks'); diff --git a/src/commands/playerachievements.ts b/src/commands/playerachievements.ts index 536e1bed9..ed865dc40 100644 --- a/src/commands/playerachievements.ts +++ b/src/commands/playerachievements.ts @@ -8,7 +8,7 @@ import cleanTable, { TableInputEntry } from '../core/interaction/cleanTable.js'; import cmdName from '../core/interaction/cmdName.js'; import infoEmbed from '../core/interaction/infoEmbed.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountAchievements } from '../types/accountAchievements.js'; import { AccountInfo } from '../types/accountInfo.js'; @@ -39,11 +39,11 @@ export default { const account = await getBlitzAccount(interaction); const { id, server } = account; const accounts = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/info/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/account/info/?application_id=${wargamingApplicationId}&account_id=${id}`, ); const accountsAchievements = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/achievements/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/account/achievements/?application_id=${wargamingApplicationId}&account_id=${id}`, ); const accountAchievements = accountsAchievements[id]; const compound = { diff --git a/src/commands/playerinfo.ts b/src/commands/playerinfo.ts index 82c83a05d..a6f91953e 100644 --- a/src/commands/playerinfo.ts +++ b/src/commands/playerinfo.ts @@ -7,7 +7,7 @@ import cleanTable from '../core/interaction/cleanTable.js'; import cmdName from '../core/interaction/cmdName.js'; import infoEmbed from '../core/interaction/infoEmbed.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo } from '../types/accountInfo.js'; @@ -25,7 +25,7 @@ export default { const account = await getBlitzAccount(interaction); const { id, server } = account; const accounts = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/info/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/account/info/?application_id=${wargamingApplicationId}&account_id=${id}`, ); const accountInfo = accounts[id]; diff --git a/src/commands/searchclans.ts b/src/commands/searchclans.ts index db07881eb..3b6a50345 100644 --- a/src/commands/searchclans.ts +++ b/src/commands/searchclans.ts @@ -6,7 +6,7 @@ import cmdName from '../core/interaction/cmdName.js'; import infoEmbed from '../core/interaction/infoEmbed.js'; import addClanChoices from '../core/options/addClanChoices.js'; import addServerChoices from '../core/options/addServerChoices.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { ClanList } from '../types/clanList.js'; @@ -33,7 +33,7 @@ export default { const clan = interaction.options.getString('clan')!; const limit = interaction.options.getInteger('limit') ?? 25; const clanList = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/clans/list/?application_id=${args['wargaming-application-id']}&search=${clan}&limit=${limit}`, + `https://api.wotblitz.${server}/wotb/clans/list/?application_id=${wargamingApplicationId}&search=${clan}&limit=${limit}`, ); await interaction.editReply({ diff --git a/src/commands/searchplayers.ts b/src/commands/searchplayers.ts index d0f731cd8..83bc9ae79 100644 --- a/src/commands/searchplayers.ts +++ b/src/commands/searchplayers.ts @@ -7,7 +7,7 @@ import cmdName from '../core/interaction/cmdName.js'; import infoEmbed from '../core/interaction/infoEmbed.js'; import addServerChoices from '../core/options/addServerChoices.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountList } from '../types/accountList.js'; @@ -38,9 +38,9 @@ export default { const trimmedSearch = name.trim(); const players = usernamePattern.test(trimmedSearch) ? await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/list/?application_id=${ - args['wargaming-application-id'] - }&search=${encodeURIComponent(trimmedSearch)}&limit=${limit}`, + `https://api.wotblitz.${server}/wotb/account/list/?application_id=${wargamingApplicationId}&search=${encodeURIComponent( + trimmedSearch, + )}&limit=${limit}`, ) : []; diff --git a/src/commands/stats.tsx b/src/commands/stats.tsx index 81602e500..947eeba37 100644 --- a/src/commands/stats.tsx +++ b/src/commands/stats.tsx @@ -28,7 +28,7 @@ import addStatPeriodChoices, { statPeriodNames, } from '../core/options/addStatPeriodChoices.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import render from '../core/ui/render.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { @@ -53,10 +53,10 @@ export default { const period = interaction.options.getString('period') as StatPeriod; const { id, server } = await getBlitzAccount(interaction); const accountInfo = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/info/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/account/info/?application_id=${wargamingApplicationId}&account_id=${id}`, ); const clanData = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${args['wargaming-application-id']}&account_id=${id}&extra=clan`, + `https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${wargamingApplicationId}&account_id=${id}&extra=clan`, ); const tankStats = await getTankStats(interaction, server, id); let stats: AllStats; diff --git a/src/commands/tankstats.tsx b/src/commands/tankstats.tsx index d359e82df..45e5207d9 100644 --- a/src/commands/tankstats.tsx +++ b/src/commands/tankstats.tsx @@ -33,7 +33,7 @@ import addStatPeriodChoices, { } from '../core/options/addStatPeriodChoices.js'; import addTankChoices from '../core/options/addTankChoices.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import render from '../core/ui/render.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo, AllStats } from '../types/accountInfo.js'; @@ -59,7 +59,7 @@ export default { const blitzAccount = await getBlitzAccount(interaction); const { id, server } = blitzAccount; const accountInfo = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/info/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/account/info/?application_id=${wargamingApplicationId}&account_id=${id}`, ); const tankStats = await getTankStats(interaction, server, id); let stats: AllStats; diff --git a/src/commands/today.tsx b/src/commands/today.tsx index 5dff3675b..8aab43f1d 100644 --- a/src/commands/today.tsx +++ b/src/commands/today.tsx @@ -24,7 +24,7 @@ import cmdName from '../core/interaction/cmdName.js'; import fullBlitzStarsStats from '../core/interaction/fullBlitzStarsStats.js'; import { supportBlitzStars } from '../core/interaction/supportBlitzStars.js'; import addUsernameOption from '../core/options/addUsernameOption.js'; -import { args } from '../core/process/args.js'; +import { wargamingApplicationId } from '../core/process/args.js'; import render from '../core/ui/render.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo, AllStats } from '../types/accountInfo.js'; @@ -50,10 +50,10 @@ export default { new Date().getTime() / 1000, ); const accountInfo = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/info/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/account/info/?application_id=${wargamingApplicationId}&account_id=${id}`, ); const clanData = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${args['wargaming-application-id']}&account_id=${id}&extra=clan`, + `https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${wargamingApplicationId}&account_id=${id}&extra=clan`, ); const careerTankStatsRaw = await getTankStats(interaction, server, id); const careerStats: Record = { diff --git a/src/commands/verify.ts b/src/commands/verify.ts index 7ffa34a8b..b88566c6b 100644 --- a/src/commands/verify.ts +++ b/src/commands/verify.ts @@ -7,7 +7,7 @@ import getBlitzAccount from '../core/blitz/getBlitzAccount.js'; 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 { wargamingApplicationId } from '../core/process/args.js'; import { CommandRegistry } from '../events/interactionCreate.js'; import { AccountInfo } from '../types/accountInfo.js'; import { PlayerClanData } from '../types/playerClanData.js'; @@ -26,10 +26,10 @@ export default { const blitzAccount = await getBlitzAccount(interaction); const { id, server } = blitzAccount; const accountInfo = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/account/info/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/account/info/?application_id=${wargamingApplicationId}&account_id=${id}`, ); const clanData = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${args['wargaming-application-id']}&account_id=${id}&extra=clan`, + `https://api.wotblitz.${server}/wotb/clans/accountinfo/?application_id=${wargamingApplicationId}&account_id=${id}&extra=clan`, ); const clan = clanData[id]?.clan; const clanTag = clan ? ` [${clan!.tag}]` : ''; diff --git a/src/core/blitz/getTankStats.ts b/src/core/blitz/getTankStats.ts index 5dac94cf3..912dbce02 100644 --- a/src/core/blitz/getTankStats.ts +++ b/src/core/blitz/getTankStats.ts @@ -1,7 +1,7 @@ import { CacheType, ChatInputCommandInteraction } from 'discord.js'; import { BLITZ_SERVERS, BlitzServer } from '../../constants/servers.js'; import { TanksStats } from '../../types/tanksStats.js'; -import { args } from '../process/args.js'; +import { wargamingApplicationId } from '../process/args.js'; import errorWithCause from '../process/errorWithCause.js'; import getWargamingResponse from './getWargamingResponse.js'; @@ -11,7 +11,7 @@ export default async function getTankStats( id: number, ) { const tankStats = await getWargamingResponse( - `https://api.wotblitz.${server}/wotb/tanks/stats/?application_id=${args['wargaming-application-id']}&account_id=${id}`, + `https://api.wotblitz.${server}/wotb/tanks/stats/?application_id=${wargamingApplicationId}&account_id=${id}`, ); if (tankStats[id] === null) { diff --git a/src/core/blitz/listAccountsPanServer.ts b/src/core/blitz/listAccountsPanServer.ts index 13137e432..b868eb8a5 100644 --- a/src/core/blitz/listAccountsPanServer.ts +++ b/src/core/blitz/listAccountsPanServer.ts @@ -1,6 +1,6 @@ import { BlitzServer } from '../../constants/servers.js'; import { Account, AccountList } from '../../types/accountList.js'; -import { args } from '../process/args.js'; +import { wargamingApplicationId } from '../process/args.js'; import getWargamingResponse from './getWargamingResponse.js'; export type AccountListWithServer = (Account & { @@ -19,7 +19,7 @@ export default async function listAccountsPanServer(search: string, limit = 9) { return ( await Promise.all([ getWargamingResponse( - `https://api.wotblitz.com/wotb/account/list/?application_id=${args['wargaming-application-id']}&search=${encodedSearch}&limit=${normalizedLimit}`, + `https://api.wotblitz.com/wotb/account/list/?application_id=${wargamingApplicationId}&search=${encodedSearch}&limit=${normalizedLimit}`, ).then( (value) => value && @@ -29,7 +29,7 @@ export default async function listAccountsPanServer(search: string, limit = 9) { })), ), getWargamingResponse( - `https://api.wotblitz.eu/wotb/account/list/?application_id=${args['wargaming-application-id']}&search=${encodedSearch}&limit=${normalizedLimit}`, + `https://api.wotblitz.eu/wotb/account/list/?application_id=${wargamingApplicationId}&search=${encodedSearch}&limit=${normalizedLimit}`, ).then( (value) => value && @@ -39,7 +39,7 @@ export default async function listAccountsPanServer(search: string, limit = 9) { })), ), getWargamingResponse( - `https://api.wotblitz.asia/wotb/account/list/?application_id=${args['wargaming-application-id']}&search=${encodedSearch}&limit=${normalizedLimit}`, + `https://api.wotblitz.asia/wotb/account/list/?application_id=${wargamingApplicationId}&search=${encodedSearch}&limit=${normalizedLimit}`, ).then( (value) => value && diff --git a/src/core/blitz/listClansPanServer.ts b/src/core/blitz/listClansPanServer.ts index 8822831e7..cf81c97ff 100644 --- a/src/core/blitz/listClansPanServer.ts +++ b/src/core/blitz/listClansPanServer.ts @@ -1,6 +1,6 @@ import { BlitzServer } from '../../constants/servers.js'; import { Clan, ClanList } from '../../types/clanList.js'; -import { args } from '../process/args.js'; +import { wargamingApplicationId } from '../process/args.js'; import getWargamingResponse from './getWargamingResponse.js'; export type ClanListWithServer = (Clan & { @@ -15,7 +15,7 @@ export default async function listClansPanServer(search: string, limit = 9) { return ( await Promise.all([ getWargamingResponse( - `https://api.wotblitz.com/wotb/clans/list/?application_id=${args['wargaming-application-id']}&search=${search}&limit=${normalizedLimit}`, + `https://api.wotblitz.com/wotb/clans/list/?application_id=${wargamingApplicationId}&search=${search}&limit=${normalizedLimit}`, ).then( (value) => value && @@ -25,7 +25,7 @@ export default async function listClansPanServer(search: string, limit = 9) { })), ), getWargamingResponse( - `https://api.wotblitz.eu/wotb/clans/list/?application_id=${args['wargaming-application-id']}&search=${search}&limit=${normalizedLimit}`, + `https://api.wotblitz.eu/wotb/clans/list/?application_id=${wargamingApplicationId}&search=${search}&limit=${normalizedLimit}`, ).then( (value) => value && @@ -35,7 +35,7 @@ export default async function listClansPanServer(search: string, limit = 9) { })), ), getWargamingResponse( - `https://api.wotblitz.asia/wotb/clans/list/?application_id=${args['wargaming-application-id']}&search=${search}&limit=${normalizedLimit}`, + `https://api.wotblitz.asia/wotb/clans/list/?application_id=${wargamingApplicationId}&search=${search}&limit=${normalizedLimit}`, ).then( (value) => value && diff --git a/src/core/process/args.ts b/src/core/process/args.ts index 1e3f490c1..ad5eaf730 100644 --- a/src/core/process/args.ts +++ b/src/core/process/args.ts @@ -3,7 +3,7 @@ import errorWithCause from './errorWithCause.js'; type ArgumentName = 'discord-token' | 'wargaming-application-id'; -export const args: Record = { +const args: Record = { 'discord-token': '', 'wargaming-application-id': '', }; @@ -23,3 +23,6 @@ Object.keys(args).forEach((arg) => { ); } }); + +export const discordToken = args['discord-token']; +export const wargamingApplicationId = args['wargaming-application-id']; diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index 236a3ecf5..1ff1a293c 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -15,7 +15,7 @@ import { import { readdirSync } from 'fs'; import discord from '../../discord.json' assert { type: 'json' }; import negativeEmbed from '../core/interaction/negativeEmbed.js'; -import { args } from '../core/process/args.js'; +import { discordToken } from '../core/process/args.js'; import getClientId from '../core/process/getClientId.js'; import isDev from '../core/process/isDev.js'; import { handleError } from './error.js'; @@ -30,7 +30,7 @@ export interface CommandRegistry { autocomplete?: (interaction: AutocompleteInteraction) => void; } -const rest = new REST().setToken(args['discord-token']); +const rest = new REST().setToken(discordToken); const commandFolders = readdirSync('src/commands/'); const commandCollection = new Collection(); diff --git a/src/index.ts b/src/index.ts index bd3cf6eee..e2770895a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import { Client, GatewayIntentBits } from 'discord.js'; -import { args } from './core/process/args.js'; +import { discordToken } from './core/process/args.js'; import { registerErrorHandlers } from './events/error.js'; import guildMemberAdd from './events/guildMemberAdd.js'; import interactionCreate from './events/interactionCreate.js'; @@ -15,4 +15,4 @@ client .on('ready', ready) .on('guildMemberAdd', guildMemberAdd) .on('interactionCreate', interactionCreate) - .login(args['discord-token']); + .login(discordToken); From 1e32da01ee876776fd2a56f854695c464b9a604f Mon Sep 17 00:00:00 2001 From: tresabhi Date: Thu, 8 Jun 2023 00:53:26 +0000 Subject: [PATCH 02/10] feat: simplified command registration --- src/core/env.d.ts | 1 + src/events/interactionCreate.ts | 68 ++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 src/core/env.d.ts diff --git a/src/core/env.d.ts b/src/core/env.d.ts new file mode 100644 index 000000000..11f02fe2a --- /dev/null +++ b/src/core/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index 1ff1a293c..294c5b5a0 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -5,14 +5,12 @@ import { ButtonStyle, CacheType, ChatInputCommandInteraction, - Collection, Interaction, REST, RESTPostAPIChatInputApplicationCommandsJSONBody, Routes, SlashCommandBuilder, } from 'discord.js'; -import { readdirSync } from 'fs'; import discord from '../../discord.json' assert { type: 'json' }; import negativeEmbed from '../core/interaction/negativeEmbed.js'; import { discordToken } from '../core/process/args.js'; @@ -32,50 +30,58 @@ export interface CommandRegistry { const rest = new REST().setToken(discordToken); -const commandFolders = readdirSync('src/commands/'); -const commandCollection = new Collection(); +const commands = Object.entries( + import.meta.glob('../commands/*', { + eager: true, + import: 'default', + }), +).reduce>((accumulator, [, registry]) => { + return { ...accumulator, [registry.command.name]: registry }; +}, {}); + export const guildCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = []; export const publicCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = []; -for (const file of commandFolders) { - const command = (await import(`../commands/${file}`)) - .default as CommandRegistry; - - if (isDev() ? command.inDevelopment : command.inProduction) { - if (command.inPublic) { - publicCommands.push(command.command.toJSON()); +Object.entries(commands).forEach(([, registry]) => { + if (isDev() ? registry.inDevelopment : registry.inProduction) { + if (registry.inPublic) { + publicCommands.push(registry.command.toJSON()); } else { - guildCommands.push(command.command.toJSON()); + guildCommands.push(registry.command.toJSON()); } - - commandCollection.set(command.command.name, command); } -} +}); try { console.log(`Refreshing ${publicCommands.length} public command(s).`); - const publicData = (await rest.put( - Routes.applicationCommands(getClientId()), - { body: publicCommands }, - )) as RESTPostAPIChatInputApplicationCommandsJSONBody[]; - console.log(`Successfully refreshed ${publicData.length} public command(s).`); + rest + .put(Routes.applicationCommands(getClientId()), { body: publicCommands }) + .then((publicData) => { + console.log( + `Successfully refreshed ${ + (publicData as RESTPostAPIChatInputApplicationCommandsJSONBody[]) + .length + } public command(s).`, + ); + }); console.log(`Refreshing ${guildCommands.length} guild command(s).`); - const guildData = [ - ...((await rest.put( + Promise.all([ + rest.put( Routes.applicationGuildCommands(getClientId(), discord.sklld_guild_id), { body: guildCommands }, - )) as RESTPostAPIChatInputApplicationCommandsJSONBody[]), - ...((await rest.put( + ), + rest.put( Routes.applicationGuildCommands(getClientId(), discord.tres_guild_id), { body: guildCommands }, - )) as RESTPostAPIChatInputApplicationCommandsJSONBody[]), - ]; - console.log( - `Successfully refreshed ${guildData.length / 2} guild command(s).`, - ); + ), + ]).then((guildData) => { + console.log( + `Successfully refreshed ${guildData.flat().length / 2} guild command(s).`, + ); + }); } catch (error) { console.error(error); } @@ -84,7 +90,7 @@ export default async function interactionCreate( interaction: Interaction, ) { if (interaction.isAutocomplete()) { - const command = commandCollection.get(interaction.commandName); + const command = commands[interaction.commandName]; if (!command) { console.error( @@ -95,7 +101,7 @@ export default async function interactionCreate( if (command.autocomplete) command.autocomplete(interaction); } else if (interaction.isChatInputCommand()) { - const command = commandCollection.get(interaction.commandName); + const command = commands[interaction.commandName]; if (!command) { console.error( From a1a13df7ce04de660f5eba6e0e63aadea84cd8cd Mon Sep 17 00:00:00 2001 From: tresabhi Date: Thu, 8 Jun 2023 00:57:29 +0000 Subject: [PATCH 03/10] feat: non-blocking tankopedia caching --- src/core/blitz/tankopedia.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/core/blitz/tankopedia.ts b/src/core/blitz/tankopedia.ts index 8408d1559..835131ae0 100644 --- a/src/core/blitz/tankopedia.ts +++ b/src/core/blitz/tankopedia.ts @@ -19,12 +19,18 @@ export interface Tankopedia { } console.log('Caching tankopedia...'); -export const tankopedia = ( - (await ( - await fetch('https://www.blitzstars.com/bs-tankopedia.json') - ).json()) as WargamingResponse & { status: 'ok' } -).data; -console.log('Cached tankopedia'); +export const tankopedia: Tankopedia = {}; +fetch('https://www.blitzstars.com/bs-tankopedia.json') + .then( + (response) => + response.json() as Promise< + WargamingResponse & { status: 'ok' } + >, + ) + .then((wargamingResponse) => { + Object.assign(tankopedia, wargamingResponse.data); + console.log('Cached tankopedia'); + }); export const TANK_ICONS: Record = { 'AT-SPG': 'https://i.imgur.com/BIHSEH0.png', From f28e8c8acb6f9d05133a24c167fafa68bb723076 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Thu, 8 Jun 2023 01:01:24 +0000 Subject: [PATCH 04/10] feat: non-blocking tank averages caching --- src/core/blitz/tankopedia.ts | 3 ++- src/core/blitzstars/tankAverages.ts | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/core/blitz/tankopedia.ts b/src/core/blitz/tankopedia.ts index 835131ae0..6017dcc87 100644 --- a/src/core/blitz/tankopedia.ts +++ b/src/core/blitz/tankopedia.ts @@ -18,8 +18,9 @@ export interface Tankopedia { [id: number]: TankopediaEntry; } -console.log('Caching tankopedia...'); export const tankopedia: Tankopedia = {}; + +console.log('Caching tankopedia...'); fetch('https://www.blitzstars.com/bs-tankopedia.json') .then( (response) => diff --git a/src/core/blitzstars/tankAverages.ts b/src/core/blitzstars/tankAverages.ts index 7d6e5bce2..747f5a449 100644 --- a/src/core/blitzstars/tankAverages.ts +++ b/src/core/blitzstars/tankAverages.ts @@ -63,7 +63,7 @@ export interface MeanSd { spbSd: number; } -export interface IndividualTankAverages { +export interface IndividualTankAverage { _id: number; battle_life_time: number; total_battle_life_time: number; @@ -78,13 +78,14 @@ export interface IndividualTankAverages { last_update: number; } -console.log('Caching tank averages...'); -const tankAveragesRaw = (await ( - await fetch('https://www.blitzstars.com/api/tankaverages.json') -).json()) as IndividualTankAverages[]; -export const tankAverages: Record = {}; +export const tankAverages: Record = {}; -Object.entries(tankAveragesRaw).forEach(([, tank]) => { - tankAverages[tank.tank_id] = tank; -}); -console.log('Tank averages cached'); +console.log('Caching tank averages...'); +fetch('https://www.blitzstars.com/api/tankaverages.json') + .then((response) => response.json() as Promise) + .then((individualTankAverages) => { + individualTankAverages.forEach((individualTankAverage) => { + tankAverages[individualTankAverage.tank_id] = individualTankAverage; + }); + console.log('Tank averages cached'); + }); From 1b59ca9bb5df1f8a9fd8b8a45383fca1a5f06f97 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Thu, 8 Jun 2023 01:10:14 +0000 Subject: [PATCH 05/10] feat: non-blocking font importing --- src/core/ui/render.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/ui/render.tsx b/src/core/ui/render.tsx index 10afb44ef..2602a807d 100644 --- a/src/core/ui/render.tsx +++ b/src/core/ui/render.tsx @@ -6,8 +6,12 @@ import satori from 'satori'; const FONT_NAME = 'Roboto'; const FONT_FILES = ['Roboto', 'Roboto-Bold', 'Roboto-Black']; +let robotoFlex: Buffer; +let robotoFlexBold: Buffer; +let robotoFlexBlack: Buffer; + console.log('Importing fonts...'); -const [robotoFlex, robotoFlexBold, robotoFlexBlack] = await Promise.all( +await Promise.all( FONT_FILES.map( (file) => new Promise((resolve, reject) => { @@ -17,8 +21,10 @@ const [robotoFlex, robotoFlexBold, robotoFlexBlack] = await Promise.all( }); }), ), -); -console.log('Fonts imported'); +).then((data) => { + [robotoFlex, robotoFlexBold, robotoFlexBlack] = data; + console.log('Fonts imported'); +}); export default async function render(element: ReactNode) { const svg = await satori(element, { From 1affdce512c987aa0cc8c3325d7caff654dadfd7 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Thu, 8 Jun 2023 01:11:47 +0000 Subject: [PATCH 06/10] feat: cleaned up startup --- src/events/error.ts | 2 -- src/index.ts | 12 +++++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/events/error.ts b/src/events/error.ts index 1f615cf63..117182ded 100644 --- a/src/events/error.ts +++ b/src/events/error.ts @@ -37,6 +37,4 @@ export function registerErrorHandlers() { client.on(name, (error) => handleError(error, 'client error')), ); } - - return client; } diff --git a/src/index.ts b/src/index.ts index e2770895a..caadbc5f3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,12 +7,10 @@ import ready from './events/ready.js'; export const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers], -}); - -registerErrorHandlers(); - -client +}) .on('ready', ready) .on('guildMemberAdd', guildMemberAdd) - .on('interactionCreate', interactionCreate) - .login(discordToken); + .on('interactionCreate', interactionCreate); + +registerErrorHandlers(); +client.login(discordToken); From e03f4c38044fc46e19b1f55ecf04399cc234cd91 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Thu, 8 Jun 2023 01:38:39 +0000 Subject: [PATCH 07/10] fix: unnecessary await --- src/core/ui/render.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ui/render.tsx b/src/core/ui/render.tsx index 2602a807d..b55c6956a 100644 --- a/src/core/ui/render.tsx +++ b/src/core/ui/render.tsx @@ -11,7 +11,7 @@ let robotoFlexBold: Buffer; let robotoFlexBlack: Buffer; console.log('Importing fonts...'); -await Promise.all( +Promise.all( FONT_FILES.map( (file) => new Promise((resolve, reject) => { From c0bbb6838218dd223810bbed4bf5b059ab03af1b Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 9 Jun 2023 01:40:50 +0000 Subject: [PATCH 08/10] feat: ignore dist --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a5f00f30e..6b1a9575a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ package-lock.json /test-results/ /playwright-report/ /playwright/.cache/ +dist/ From a31cea2ba060eedee6c1334f19cb737da67a5dd0 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Sat, 10 Jun 2023 01:09:07 +0000 Subject: [PATCH 09/10] feat: build script --- .github/workflows/ci-build.yml | 47 +++++++++++++ package.json | 8 ++- src/events/interactionCreate.ts | 36 ++++++++-- yarn.lock | 119 +------------------------------- 4 files changed, 84 insertions(+), 126 deletions(-) create mode 100644 .github/workflows/ci-build.yml diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 000000000..df3789d87 --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,47 @@ +name: CI Build + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - name: Get code + uses: actions/checkout@v3 + + - name: Use node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install Yarn + run: npm install --location=global yarn + + - name: Use node_modules cache + uses: actions/cache@v3 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Install dependencies + run: yarn + + - name: Build + run: yarn build + + - name: Archive build + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist diff --git a/package.json b/package.json index 5b17c3ff9..ac539412e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "main": "index.js", "type": "module", "scripts": { - "start": "vite-node src/index.ts --script", + "dev": "yarn build && yarn start", + "start": "node --enable-source-maps dist/index.cjs", + "build": "rm -rf dist && esbuild src/index.ts --outfile=dist/index.cjs --bundle --platform=node --loader:.node=copy --minify --sourcemap", "lint": "tsc" }, "license": "MIT", @@ -28,7 +30,7 @@ "@types/markdown-escape": "^1.1.0", "@types/node": "^20.2.1", "@types/react": "^18.2.7", - "typescript": "^5.0.4", - "vite-node": "^0.31.1" + "esbuild": "^0.17.19", + "typescript": "^5.0.4" } } diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index 294c5b5a0..46d80e8f9 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -12,6 +12,20 @@ import { SlashCommandBuilder, } from 'discord.js'; import discord from '../../discord.json' assert { type: 'json' }; +import debug from '../commands/debug.js'; +import eligible from '../commands/eligible.js'; +import help from '../commands/help.js'; +import inactive from '../commands/inactive.js'; +import ownedtanks from '../commands/ownedtanks.js'; +import playerachievements from '../commands/playerachievements.js'; +import playerinfo from '../commands/playerinfo.js'; +import searchclans from '../commands/searchclans.js'; +import searchplayers from '../commands/searchplayers.js'; +import searchtanks from '../commands/searchtanks.js'; +import stats from '../commands/stats.js'; +import tankstats from '../commands/tankstats.js'; +import today from '../commands/today.js'; +import verify from '../commands/verify.js'; import negativeEmbed from '../core/interaction/negativeEmbed.js'; import { discordToken } from '../core/process/args.js'; import getClientId from '../core/process/getClientId.js'; @@ -30,12 +44,22 @@ export interface CommandRegistry { const rest = new REST().setToken(discordToken); -const commands = Object.entries( - import.meta.glob('../commands/*', { - eager: true, - import: 'default', - }), -).reduce>((accumulator, [, registry]) => { +const commands = [ + debug, + eligible, + help, + inactive, + ownedtanks, + playerachievements, + playerinfo, + searchclans, + searchplayers, + searchtanks, + stats, + tankstats, + today, + verify, +].reduce>((accumulator, registry) => { return { ...accumulator, [registry.command.name]: registry }; }, {}); diff --git a/yarn.lock b/yarn.lock index 36e6a48e2..dedafa72b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -333,11 +333,6 @@ dependencies: "@types/node" "*" -acorn@^8.8.2: - version "8.8.2" - resolved "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz" - integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== - base64-js@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-0.0.8.tgz#1101e9544f4a76b1bc3b26d452ca96d7a35e7978" @@ -355,11 +350,6 @@ busboy@^1.6.0: dependencies: streamsearch "^1.1.0" -cac@^6.7.14: - version "6.7.14" - resolved "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz" - integrity sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ== - camelize@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.1.tgz#89b7e16884056331a35d6b5ad064332c91daa6c3" @@ -399,13 +389,6 @@ csstype@^3.0.2: resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== -debug@^4.3.4: - version "4.3.4" - resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - discord-api-types@^0.37.37: version "0.37.39" resolved "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.39.tgz" @@ -435,9 +418,9 @@ emoji-regex@^10.2.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.2.1.tgz#a41c330d957191efd3d9dfe6e1e8e1e9ab048b3f" integrity sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA== -esbuild@^0.17.5: +esbuild@^0.17.19: version "0.17.19" - resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.19.tgz#087a727e98299f0462a3d0bcdd9cd7ff100bd955" integrity sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw== optionalDependencies: "@esbuild/android-arm" "0.17.19" @@ -487,11 +470,6 @@ file-type@^18.2.1: strtok3 "^7.0.0" token-types "^5.0.1" -fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - fuzzysort@^2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/fuzzysort/-/fuzzysort-2.0.4.tgz" @@ -517,11 +495,6 @@ inherits@^2.0.3: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -jsonc-parser@^3.2.0: - version "3.2.0" - resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz" - integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== - linebreak@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/linebreak/-/linebreak-1.1.0.tgz#831cf378d98bced381d8ab118f852bd50d81e46b" @@ -557,26 +530,6 @@ markdown-escape@^2.0.0: resolved "https://registry.npmjs.org/markdown-escape/-/markdown-escape-2.0.0.tgz" integrity sha512-Trz4v0+XWlwy68LJIyw3bLbsJiC8XAbRCKF9DbEtZjyndKOGVx6n+wNB0VfoRmY2LKboQLeniap3xrb6LGSJ8A== -mlly@^1.2.0: - version "1.2.1" - resolved "https://registry.npmjs.org/mlly/-/mlly-1.2.1.tgz" - integrity sha512-1aMEByaWgBPEbWV2BOPEMySRrzl7rIHXmQxam4DM8jVjalTQDjpN2ZKOLUrwyhfZQO7IXHml2StcHMhooDeEEQ== - dependencies: - acorn "^8.8.2" - pathe "^1.1.0" - pkg-types "^1.0.3" - ufo "^1.1.2" - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -nanoid@^3.3.6: - version "3.3.6" - resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz" - integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== - pako@^0.2.5: version "0.2.9" resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" @@ -590,44 +543,16 @@ parse-css-color@^0.2.1: color-name "^1.1.4" hex-rgb "^4.1.0" -pathe@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/pathe/-/pathe-1.1.0.tgz" - integrity sha512-ODbEPR0KKHqECXW1GoxdDb+AZvULmXjVPy4rt+pGo2+TnjJTIPJQSVS6N63n8T2Ip+syHhbn52OewKicV0373w== - peek-readable@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0.tgz" integrity sha512-YtCKvLUOvwtMGmrniQPdO7MwPjgkFBtFIrmfSbYmYuq3tKDV/mcfAhBth1+C3ru7uXIZasc/pHnb+YDYNkkj4A== -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== - -pkg-types@^1.0.3: - version "1.0.3" - resolved "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz" - integrity sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A== - dependencies: - jsonc-parser "^3.2.0" - mlly "^1.2.0" - pathe "^1.1.0" - postcss-value-parser@^4.0.2, postcss-value-parser@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== -postcss@^8.4.23: - version "8.4.23" - resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.23.tgz" - integrity sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA== - dependencies: - nanoid "^3.3.6" - picocolors "^1.0.0" - source-map-js "^1.0.2" - react@^18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" @@ -651,13 +576,6 @@ readable-web-to-node-stream@^3.0.2: dependencies: readable-stream "^3.6.0" -rollup@^3.21.0: - version "3.22.0" - resolved "https://registry.npmjs.org/rollup/-/rollup-3.22.0.tgz" - integrity sha512-imsigcWor5Y/dC0rz2q0bBt9PabcL3TORry2hAa6O6BuMvY71bqHyfReAz5qyAqiQATD1m70qdntqBfBQjVWpQ== - optionalDependencies: - fsevents "~2.3.2" - safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" @@ -678,11 +596,6 @@ satori@^0.9.1: postcss-value-parser "^4.2.0" yoga-wasm-web "^0.3.3" -source-map-js@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz" - integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== - streamsearch@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz" @@ -736,11 +649,6 @@ typescript@^5.0.4: resolved "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz" integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== -ufo@^1.1.2: - version "1.1.2" - resolved "https://registry.npmjs.org/ufo/-/ufo-1.1.2.tgz" - integrity sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ== - undici@^5.21.0: version "5.21.2" resolved "https://registry.npmjs.org/undici/-/undici-5.21.2.tgz" @@ -761,29 +669,6 @@ util-deprecate@^1.0.1: resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== -vite-node@^0.31.1: - version "0.31.1" - resolved "https://registry.npmjs.org/vite-node/-/vite-node-0.31.1.tgz" - integrity sha512-BajE/IsNQ6JyizPzu9zRgHrBwczkAs0erQf/JRpgTIESpKvNj9/Gd0vxX905klLkb0I0SJVCKbdrl5c6FnqYKA== - dependencies: - cac "^6.7.14" - debug "^4.3.4" - mlly "^1.2.0" - pathe "^1.1.0" - picocolors "^1.0.0" - vite "^3.0.0 || ^4.0.0" - -"vite@^3.0.0 || ^4.0.0": - version "4.3.8" - resolved "https://registry.npmjs.org/vite/-/vite-4.3.8.tgz" - integrity sha512-uYB8PwN7hbMrf4j1xzGDk/lqjsZvCDbt/JC5dyfxc19Pg8kRm14LinK/uq+HSLNswZEoKmweGdtpbnxRtrAXiQ== - dependencies: - esbuild "^0.17.5" - postcss "^8.4.23" - rollup "^3.21.0" - optionalDependencies: - fsevents "~2.3.2" - ws@^8.13.0: version "8.13.0" resolved "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz" From e125714c5590e1ecf61c4b0c1e866605748538f1 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Sat, 10 Jun 2023 01:22:35 +0000 Subject: [PATCH 10/10] fix: host command --- .github/workflows/host.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/host.yml b/.github/workflows/host.yml index 350b9d0a7..917086511 100644 --- a/.github/workflows/host.yml +++ b/.github/workflows/host.yml @@ -44,4 +44,4 @@ jobs: run: yarn - name: Host - run: yarn run start discord-token=${{ secrets.DISCORD_TOKEN }} wargaming-application-id=${{ secrets.WARGAMING_APPLICATION_ID }} + run: yarn dev discord-token=${{ secrets.DISCORD_TOKEN }} wargaming-application-id=${{ secrets.WARGAMING_APPLICATION_ID }}