fix: try and catch for encoding

This commit is contained in:
TresAbhi committed 2023-06-02 01:50:18 +00:00
1 parent f4b20611d5
commit 2c8ae40ff8
5 files changed
+17 -19

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "blitzkrieg",
"version": "1.4.1",
"version": "1.5.1",
"description": "",
"main": "index.js",
"type": "module",
+1 -1
View File
@@ -39,7 +39,7 @@ import { PlayerClanData } from '../types/playerClanData.js';
export default {
inProduction: true,
inDevelopment: true,
inDevelopment: false,
inPublic: true,
command: new SlashCommandBuilder()
+1 -1
View File
@@ -40,7 +40,7 @@ import { TanksStats } from '../types/tanksStats.js';
export default {
inProduction: true,
inDevelopment: true,
inDevelopment: false,
inPublic: true,
command: new SlashCommandBuilder()
+2 -7
View File
@@ -33,7 +33,7 @@ import { TanksStats } from '../types/tanksStats.js';
export default {
inProduction: true,
inDevelopment: true,
inDevelopment: false,
inPublic: true,
command: new SlashCommandBuilder()
@@ -191,12 +191,7 @@ export default {
await interaction.editReply({
embeds:
rows.length >= 6
? [
infoEmbed(
'Very large image!',
"Don't forget to oom in.",
),
]
? [infoEmbed('Very large image!', "Don't forget to oom in.")]
: undefined,
files: [image],
components: [actionRow],
+12 -9
View File
@@ -1,5 +1,4 @@
import { WargamingResponse } from '../../types/wargamingResponse.js';
import isDev from '../process/isDev.js';
import URLToBase64 from '../ui/URLToBase64.js';
/*
@@ -58,12 +57,16 @@ export const TANK_IDS = Object.keys(tankopedia).map((id) => Number(id));
export const TANKS = TANK_IDS.map((id) => tankopedia[id]);
export const TANK_NAMES = TANKS.map((tank) => tank.name);
if (!isDev()) {
console.log('Encoding tank images...');
await Promise.all(
Object.entries(tankopedia).map(async ([, tank]) => {
console.log('Encoding tank images...');
await Promise.all(
Object.entries(tankopedia).map(async ([, tank]) => {
try {
tank.images.normal = await URLToBase64(tank.images.normal);
}),
);
console.log('Encoded tank images');
}
} catch (error) {
console.warn(
`Failed to encode tank image for ${tank.images.normal}: ${error}`,
);
}
}),
);
console.log('Encoded tank images');