Modify startup sequence to use sendAlert
This commit is contained in:
parent
76d6df7e26
commit
cb4f6fc5fd
10
main.js
10
main.js
@ -5,6 +5,7 @@ const dotenv = require('dotenv');
|
|||||||
dotenv.config();
|
dotenv.config();
|
||||||
const token = process.env.TOKEN;
|
const token = process.env.TOKEN;
|
||||||
const statusChannelId = process.env.statusChannelId;
|
const statusChannelId = process.env.statusChannelId;
|
||||||
|
const ownerId = process.env.ownerId;
|
||||||
|
|
||||||
// Dump the env vars to log in dev environment:
|
// Dump the env vars to log in dev environment:
|
||||||
if (process.env.isDev === "true") console.log(JSON.stringify(process.env));
|
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 { GifData, CommandData } = require('./CustomModules/NodBot.js');
|
||||||
const ButtonHandlers = require('./CustomModules/ButtonHandlers.js');
|
const ButtonHandlers = require('./CustomModules/ButtonHandlers.js');
|
||||||
const InteractionStorage = require('./CustomModules/InteractionStorage.js');
|
const InteractionStorage = require('./CustomModules/InteractionStorage.js');
|
||||||
|
const appVersion = require('./package.json').version;
|
||||||
const isDev = process.env.isDev;
|
const isDev = process.env.isDev;
|
||||||
let statusChannel;
|
let statusChannel;
|
||||||
|
|
||||||
@ -53,8 +55,12 @@ client.once('ready', async () => {
|
|||||||
await fn.avWx.metar.getAllICAOs();
|
await fn.avWx.metar.getAllICAOs();
|
||||||
await fn.avWx.datis.getAllICAOs();
|
await fn.avWx.datis.getAllICAOs();
|
||||||
// console.log(JSON.stringify(icaoArray));
|
// console.log(JSON.stringify(icaoArray));
|
||||||
statusChannel = await client.channels.fetch(statusChannelId).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));
|
// 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
|
// Check for banned servers
|
||||||
fn.checkBannedServers(client, statusChannel);
|
fn.checkBannedServers(client, statusChannel);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user