mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: migrate
This commit is contained in:
1 parent
02aed3e3a5
commit
5ae6961a13
7 files changed
+26
-14
No files matched your search
@@ -10,7 +10,7 @@ const fontsPromise = [
|
|||||||
{ file: robotoBold, weight: 700 as const },
|
{ file: robotoBold, weight: 700 as const },
|
||||||
{ file: robotoBlack, weight: 900 as const },
|
{ file: robotoBlack, weight: 900 as const },
|
||||||
].map(async ({ file, weight }) => {
|
].map(async ({ file, weight }) => {
|
||||||
const data = await readFile(`dist/bot/workers/${file}`);
|
const data = await readFile(file);
|
||||||
return { name: 'Roboto', weight, data };
|
return { name: 'Roboto', weight, data };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Worker } from 'worker_threads';
|
|||||||
const RENDER_WORKERS = 1;
|
const RENDER_WORKERS = 1;
|
||||||
|
|
||||||
const workers = [...Array(RENDER_WORKERS)].map(() => {
|
const workers = [...Array(RENDER_WORKERS)].map(() => {
|
||||||
const worker = new Worker('dist/bot/workers/render.js');
|
const worker = new Worker('src/workers/render.ts');
|
||||||
console.log(`🟡 Launching render worker ${worker.threadId}`);
|
console.log(`🟡 Launching render worker ${worker.threadId}`);
|
||||||
return worker;
|
return worker;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import { TANK_CLASSES, TREE_TYPES } from '@blitzkit/core';
|
import {
|
||||||
|
TANK_CLASSES,
|
||||||
|
TANK_TYPE_COMMAND_NAMES,
|
||||||
|
TANK_TYPES,
|
||||||
|
} from '@blitzkit/core';
|
||||||
import {
|
import {
|
||||||
APIApplicationCommandOptionChoice,
|
APIApplicationCommandOptionChoice,
|
||||||
Locale,
|
Locale,
|
||||||
@@ -87,10 +91,10 @@ export function addFilterOptions<
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.addChoices(
|
.addChoices(
|
||||||
...TREE_TYPES.map(
|
...TANK_TYPES.map(
|
||||||
(treeType) =>
|
(treeType) =>
|
||||||
({
|
({
|
||||||
value: treeType,
|
value: TANK_TYPE_COMMAND_NAMES[treeType],
|
||||||
name: translate(`common.tree_type.${treeType}`),
|
name: translate(`common.tree_type.${treeType}`),
|
||||||
name_localizations: localizationObject(
|
name_localizations: localizationObject(
|
||||||
`common.tree_type.${treeType}`,
|
`common.tree_type.${treeType}`,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { assertSecret } from '@blitzkit/core';
|
import { assertSecret } from '@blitzkit/core';
|
||||||
import { ShardingManager } from 'discord.js';
|
import { ShardingManager } from 'discord.js';
|
||||||
|
|
||||||
export const manager = new ShardingManager('dist/bot/workers/bot.js', {
|
export const manager = new ShardingManager('src/workers/bot.ts', {
|
||||||
token: assertSecret(process.env.DISCORD_TOKEN),
|
token: assertSecret(process.env.DISCORD_TOKEN),
|
||||||
});
|
});
|
||||||
@@ -13,7 +13,7 @@ export const translations = SUPPORTED_LOCALES.reduce<
|
|||||||
>(
|
>(
|
||||||
(table, locale) => ({
|
(table, locale) => ({
|
||||||
...table,
|
...table,
|
||||||
[locale]: require(`../lang/${locale}.json`),
|
[locale]: require(`@blitzkit/core/lang/${locale}.json`),
|
||||||
}),
|
}),
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
@@ -25,8 +25,6 @@ import { ownedTanksCommand } from '../../commands/ownedTanks';
|
|||||||
import { permissionsCommand } from '../../commands/permissions';
|
import { permissionsCommand } from '../../commands/permissions';
|
||||||
import { pingCommand } from '../../commands/ping';
|
import { pingCommand } from '../../commands/ping';
|
||||||
import { playerInfoCommand } from '../../commands/playerInfo';
|
import { playerInfoCommand } from '../../commands/playerInfo';
|
||||||
import { ratingCommand } from '../../commands/rating';
|
|
||||||
import { ratingLeaderboardCommand } from '../../commands/ratingLeaderboard';
|
|
||||||
import { replayCommand } from '../../commands/replay';
|
import { replayCommand } from '../../commands/replay';
|
||||||
import { researchCommand } from '../../commands/research';
|
import { researchCommand } from '../../commands/research';
|
||||||
import { searchClansCommand } from '../../commands/searchClans';
|
import { searchClansCommand } from '../../commands/searchClans';
|
||||||
@@ -90,10 +88,10 @@ export const COMMANDS_RAW: Promise<CommandRegistry>[] = [
|
|||||||
pingCommand,
|
pingCommand,
|
||||||
evolutionCommand,
|
evolutionCommand,
|
||||||
statsCommand,
|
statsCommand,
|
||||||
ratingLeaderboardCommand,
|
// ratingLeaderboardCommand,
|
||||||
todayCommand,
|
todayCommand,
|
||||||
researchCommand,
|
researchCommand,
|
||||||
ratingCommand,
|
// ratingCommand,
|
||||||
replayCommand,
|
replayCommand,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,24 @@
|
|||||||
import { TankClass } from '../protos';
|
import { TankClass, TankType } from '../protos';
|
||||||
import { BlitzStats } from '../statistics';
|
import { BlitzStats } from '../statistics';
|
||||||
|
|
||||||
export const TREE_TYPES = ['researchable', 'premium', 'collector'] as const;
|
export const TANK_TYPES = [
|
||||||
|
TankType.RESEARCHABLE,
|
||||||
|
TankType.PREMIUM,
|
||||||
|
TankType.COLLECTOR,
|
||||||
|
];
|
||||||
|
|
||||||
|
export const TANK_TYPE_COMMAND_NAMES = {
|
||||||
|
[TankType.RESEARCHABLE]: 'researchable',
|
||||||
|
[TankType.PREMIUM]: 'premium',
|
||||||
|
[TankType.COLLECTOR]: 'collector',
|
||||||
|
};
|
||||||
|
|
||||||
export const TANK_CLASSES = [
|
export const TANK_CLASSES = [
|
||||||
TankClass.LIGHT,
|
TankClass.LIGHT,
|
||||||
TankClass.MEDIUM,
|
TankClass.MEDIUM,
|
||||||
TankClass.HEAVY,
|
TankClass.HEAVY,
|
||||||
TankClass.TANK_DESTROYER,
|
TankClass.TANK_DESTROYER,
|
||||||
] as const;
|
];
|
||||||
|
|
||||||
export const emptyAllStats: BlitzStats = {
|
export const emptyAllStats: BlitzStats = {
|
||||||
battles: 0,
|
battles: 0,
|
||||||
|
|||||||
Reference in new issue
Block a user