Modify startup sequence to use sendAlert

This commit is contained in:
Skylar Grant 2026-10-01 21:10:57 -04:00
parent 76d6df7e26
commit cb4f6fc5fd

10
main.js
View File

@ -5,6 +5,7 @@ const dotenv = require('dotenv');
dotenv.config();
const token = process.env.TOKEN;
const statusChannelId = process.env.statusChannelId;
const ownerId = process.env.ownerId;
// Dump the env vars to log in dev environment:
if (process.env.isDev === "true") console.log(JSON.stringify(process.env));
@ -33,6 +34,7 @@ const strings = require('./strings.json');
const { GifData, CommandData } = require('./CustomModules/NodBot.js');
const ButtonHandlers = require('./CustomModules/ButtonHandlers.js');
const InteractionStorage = require('./CustomModules/InteractionStorage.js');
const appVersion = require('./package.json').version;
const isDev = process.env.isDev;
let statusChannel;
@ -53,8 +55,12 @@ client.once('ready', async () => {
await fn.avWx.metar.getAllICAOs();
await fn.avWx.datis.getAllICAOs();
// console.log(JSON.stringify(icaoArray));
statusChannel = await client.channels.fetch(statusChannelId).catch(e => console.error(e));
await statusChannel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`).catch(e => console.error(e));
// statusChannel = await client.channels.fetch(statusChannelId).catch(e => console.error(e));
// await statusChannel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`).catch(e => console.error(e));
const readyTimestamp = new Date().toISOString();
const readyMessage = readyTimestamp + ' -- <@' + ownerId + '>\nStartup Sequence Complete';
const readyMsgEmbed = fn.embeds.text({ command: 'Boot', content: readyMessage, author: appVersion });
await fn.sendAlert(readyMsgEmbed, client);
// Check for banned servers
fn.checkBannedServers(client, statusChannel);
});