mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: simpler logging
This commit is contained in:
1 parent
43f634e198
commit
9495ae2336
7 files changed
+7
-22
No files matched your search
@@ -2,5 +2,7 @@ import { registerProcesses } from './core/blitzkrieg/processes';
|
||||
import { secrets } from './core/blitzkrieg/secrets';
|
||||
import { client } from './core/discord/client';
|
||||
|
||||
console.log(`🟡 Launching bot ${client.shard?.ids[0]}`);
|
||||
|
||||
registerProcesses();
|
||||
client.login(secrets.DISCORD_TOKEN);
|
||||
@@ -12,7 +12,6 @@ let roboto: Buffer;
|
||||
let robotoBold: Buffer;
|
||||
let robotoBlack: Buffer;
|
||||
|
||||
console.log('Importing fonts...');
|
||||
Promise.all(
|
||||
FONT_FILES.map(
|
||||
(file) =>
|
||||
@@ -27,7 +26,6 @@ Promise.all(
|
||||
),
|
||||
).then((data) => {
|
||||
[roboto, robotoBold, robotoBlack] = data;
|
||||
console.log('Fonts imported');
|
||||
});
|
||||
|
||||
export default async function jsxToSvg(jsx: JSX.Element) {
|
||||
|
||||
@@ -84,7 +84,6 @@ tankopedia;
|
||||
|
||||
export type TankAverages = Record<number, IndividualTankAverage>;
|
||||
|
||||
console.log('Caching tank averages...');
|
||||
export const tankAverages = fetch(
|
||||
context === 'bot'
|
||||
? 'https://www.blitzstars.com/api/tankaverages.json'
|
||||
@@ -100,8 +99,6 @@ export const tankAverages = fetch(
|
||||
individualTankAverage;
|
||||
});
|
||||
|
||||
console.log('Tank averages cached');
|
||||
|
||||
return partialTankAverages;
|
||||
} else {
|
||||
return json as TankAverages;
|
||||
|
||||
@@ -27,12 +27,11 @@ export const tankopedia = fetch(
|
||||
: '/api/tankopedia',
|
||||
)
|
||||
.then(async (response) => response.json())
|
||||
.then((wrapperTankopedia) => {
|
||||
console.log('Tankopedia cached');
|
||||
return context === 'bot'
|
||||
.then((wrapperTankopedia) =>
|
||||
context === 'bot'
|
||||
? (wrapperTankopedia as { data: Tankopedia }).data
|
||||
: (wrapperTankopedia as Tankopedia);
|
||||
});
|
||||
: (wrapperTankopedia as Tankopedia),
|
||||
);
|
||||
const entries = new Promise<TankopediaEntry[]>(async (resolve) => {
|
||||
resolve(Object.entries(await tankopedia).map(([, entry]) => entry));
|
||||
});
|
||||
@@ -69,11 +68,9 @@ export interface TankopediaInfo {
|
||||
}
|
||||
|
||||
// this is blocking because info is needed for command creation
|
||||
console.log('Caching tankopedia info...');
|
||||
export const tankopediaInfo = fetchBlitz<TankopediaInfo>(
|
||||
`https://api.wotblitz.com/wotb/encyclopedia/info/?application_id=${WARGAMING_APPLICATION_ID}`,
|
||||
);
|
||||
console.log('Cached tankopedia info');
|
||||
|
||||
export const TANK_ICONS: Record<string, string> = {
|
||||
'AT-SPG': 'https://i.imgur.com/BIHSEH0.png',
|
||||
|
||||
@@ -9,12 +9,10 @@ export interface PSA {
|
||||
|
||||
export const psa: PSA = { data: null };
|
||||
|
||||
console.log('Caching PSA...');
|
||||
fetch(
|
||||
'https://gist.githubusercontent.com/tresabhi/ed4b136f08856e615212e573aabe1968/raw',
|
||||
)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
psa.data = data as PSAData;
|
||||
console.log('PSA cached');
|
||||
});
|
||||
@@ -136,12 +136,10 @@ commands.then((awaitedCommands) => {
|
||||
});
|
||||
|
||||
try {
|
||||
console.log(`Refreshing ${publicCommands.length} public command(s).`);
|
||||
rest.put(Routes.applicationCommands(getClientId()), {
|
||||
body: publicCommands,
|
||||
});
|
||||
|
||||
console.log(`Refreshing ${guildCommands.length} guild command(s).`);
|
||||
(isDev()
|
||||
? [discord.test_guild_id]
|
||||
: [discord.tres_guild_id, discord.sklld_guild_id]
|
||||
|
||||
+1
-6
@@ -1,10 +1,5 @@
|
||||
import { Client } from 'discord.js';
|
||||
import isDev from '../core/blitzkrieg/isDev';
|
||||
|
||||
export default function ready(client: Client<true>) {
|
||||
console.log(
|
||||
`Logged in as ${client.user.tag} in ${
|
||||
isDev() ? 'development' : 'production'
|
||||
} mode across ${client.guilds.cache.size} servers`,
|
||||
);
|
||||
console.log(`🟢 Bot ${client.shard?.ids[0]} launched`);
|
||||
}
|
||||
Reference in new issue
Block a user