improve startup logging

This commit is contained in:
bignutty 2024-12-27 00:09:21 +01:00
parent 934f6ec09f
commit b049aefad2
2 changed files with 6 additions and 15 deletions

View file

@ -35,16 +35,6 @@ const manager = new ClusterManager(client, token, {
})
await manager.run();
console.log(`[${process.env.HOSTNAME || "labscore"}] bot ready. took ${(Date.now() - time) / 1000}.`)
// This is kind of a hack.
// Our current deployment system has a tendency to launch the bot twice, this "ensures" that
// incorrect instances close again. This should *probably* just be moved to dirigent instead.
if(process.env.PB_MANAGER_HOST){
let liveDeploy = await superagent.get(`${process.env.PB_MANAGER_HOST}_pbs/v1/GetPbServiceId`)
if(process.env.HOSTNAME !== liveDeploy.body.d){
console.log(`[${process.env.HOSTNAME}] invalid deployment session`)
process.exit();
}
}
console.log(`[${process.env.HOSTNAME || "labscore"}] bot ready (${Date.now() - time}ms)`)
console.log(`[${process.env.HOSTNAME || "labscore"}] manager running shards ${manager.shardStart}-${manager.shardEnd} (${manager.shardCount})`);
})();

View file

@ -241,24 +241,25 @@ interactionClient.on('commandRunError', async ({context, error}) => {
});
try{
let clusterTimings = Date.now();
// TODO: This should in theory already be done by detritus, figure out why it isn't
await cluster.run().then();
console.log(`[${process.env.HOSTNAME || "labscore"}]{${cluster.clusterId}} cluster ran`)
console.log(`[${process.env.HOSTNAME || "labscore"}]{${cluster.clusterId}} cluster ran (${Date.now() - clusterTimings}ms)`)
let shards = `{${cluster.clusterId}} (${cluster.shards.map((shard) => shard.shardId).join(', ') })`;
console.log(`[${process.env.HOSTNAME || "labscore"}]${shards} shards loaded`)
{
await commandClient.addMultipleIn('../commands/message/');
await commandClient.run()
console.log(`[${process.env.HOSTNAME || "labscore"}]${shards} command client ready`)
console.log(`[${process.env.HOSTNAME || "labscore"}]${shards} command client ready (${Date.now() - clusterTimings}ms)`)
}
{
await interactionClient.addMultipleIn('../commands/interaction/context');
await interactionClient.addMultipleIn('../commands/interaction/user');
await interactionClient.addMultipleIn('../commands/interaction/slash');
await interactionClient.run();
console.log(`[${process.env.HOSTNAME || "labscore"}]${shards} interaction command client ready`)
console.log(`[${process.env.HOSTNAME || "labscore"}]${shards} interaction command client ready (${Date.now() - clusterTimings}ms)`)
}
} catch(e){
console.log(e)