Added message on boot

This commit is contained in:
walcutt 2024-02-27 23:05:08 -05:00
parent 1542820f89
commit 38cbb0b961
6 changed files with 25 additions and 3 deletions

3
.gitignore vendored
View File

@ -130,4 +130,5 @@ dist
.pnp.*
# secrets
botkey.txt
botkey.txt
defaultchannel.txt

3
asher/src/constants.js Normal file
View File

@ -0,0 +1,3 @@
export const textStrings = {
BOOT_MESSAGE: "Hi! Chloe just started me up! I'm not quite ready yet though!",
};

View File

@ -0,0 +1,11 @@
import { secretKeys, getSecret } from "../../../secrets.js";
import { textStrings } from "../../../constants.js";
export function startupSendMessage(readyClient) {
const channelId = getSecret(secretKeys.DEFAULT_CHANNEL);
console.log(channelId);
const channel = readyClient.channels.resolve(channelId);
channel.send(textStrings.BOOT_MESSAGE);
}

View File

@ -1,6 +1,7 @@
import { Events } from "discord.js";
// Import routines.
import { startupHeartbeat } from "./client-ready/startup-heartbeat/startupHeartbeat.js";
import { startupSendMessage } from "./client-ready/startup-send-message/startupSendMessage.js";
/*
* All bot actions are "routines" that fire off of some trigger.
@ -17,6 +18,7 @@ export const routineManifest = [
event: Events.ClientReady,
routines: [
startupHeartbeat,
startupSendMessage,
],
},
];

View File

@ -1,11 +1,13 @@
import fs from 'fs';
export const secretKeys = {
BOT_KEY: 'botkey'
BOT_KEY: 'botkey',
DEFAULT_CHANNEL: 'default-channel',
};
const secretManifest = [
secretKeys.BOT_KEY,
secretKeys.DEFAULT_CHANNEL,
];
let secrets = {};

View File

@ -10,8 +10,11 @@ services:
command: bash -c "cd /asher && npm i && npm run serve"
secrets:
- botkey
- default-channel
secrets:
botkey:
file: ./botkey.txt
file: ./botkey.txt
default-channel:
file: ./defaultchannel.txt