mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
fix: try and catch for encoding
This commit is contained in:
1 parent
f4b20611d5
commit
2c8ae40ff8
5 files changed
+17
-19
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "blitzkrieg",
|
"name": "blitzkrieg",
|
||||||
"version": "1.4.1",
|
"version": "1.5.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import { PlayerClanData } from '../types/playerClanData.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
inProduction: true,
|
inProduction: true,
|
||||||
inDevelopment: true,
|
inDevelopment: false,
|
||||||
inPublic: true,
|
inPublic: true,
|
||||||
|
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import { TanksStats } from '../types/tanksStats.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
inProduction: true,
|
inProduction: true,
|
||||||
inDevelopment: true,
|
inDevelopment: false,
|
||||||
inPublic: true,
|
inPublic: true,
|
||||||
|
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import { TanksStats } from '../types/tanksStats.js';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
inProduction: true,
|
inProduction: true,
|
||||||
inDevelopment: true,
|
inDevelopment: false,
|
||||||
inPublic: true,
|
inPublic: true,
|
||||||
|
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
@@ -191,12 +191,7 @@ export default {
|
|||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds:
|
embeds:
|
||||||
rows.length >= 6
|
rows.length >= 6
|
||||||
? [
|
? [infoEmbed('Very large image!', "Don't forget to oom in.")]
|
||||||
infoEmbed(
|
|
||||||
'Very large image!',
|
|
||||||
"Don't forget to oom in.",
|
|
||||||
),
|
|
||||||
]
|
|
||||||
: undefined,
|
: undefined,
|
||||||
files: [image],
|
files: [image],
|
||||||
components: [actionRow],
|
components: [actionRow],
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { WargamingResponse } from '../../types/wargamingResponse.js';
|
import { WargamingResponse } from '../../types/wargamingResponse.js';
|
||||||
import isDev from '../process/isDev.js';
|
|
||||||
import URLToBase64 from '../ui/URLToBase64.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 TANKS = TANK_IDS.map((id) => tankopedia[id]);
|
||||||
export const TANK_NAMES = TANKS.map((tank) => tank.name);
|
export const TANK_NAMES = TANKS.map((tank) => tank.name);
|
||||||
|
|
||||||
if (!isDev()) {
|
console.log('Encoding tank images...');
|
||||||
console.log('Encoding tank images...');
|
await Promise.all(
|
||||||
await Promise.all(
|
Object.entries(tankopedia).map(async ([, tank]) => {
|
||||||
Object.entries(tankopedia).map(async ([, tank]) => {
|
try {
|
||||||
tank.images.normal = await URLToBase64(tank.images.normal);
|
tank.images.normal = await URLToBase64(tank.images.normal);
|
||||||
}),
|
} catch (error) {
|
||||||
);
|
console.warn(
|
||||||
console.log('Encoded tank images');
|
`Failed to encode tank image for ${tank.images.normal}: ${error}`,
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
console.log('Encoded tank images');
|
||||||
Reference in new issue
Block a user