diff --git a/.gitignore b/.gitignore index 160a805..83826e4 100644 --- a/.gitignore +++ b/.gitignore @@ -130,4 +130,5 @@ dist .pnp.* # secrets -botkey.txt \ No newline at end of file +botkey.txt +defaultchannel.txt \ No newline at end of file diff --git a/asher/src/constants.js b/asher/src/constants.js new file mode 100644 index 0000000..9cbb83b --- /dev/null +++ b/asher/src/constants.js @@ -0,0 +1,3 @@ +export const textStrings = { + BOOT_MESSAGE: "Hi! Chloe just started me up! I'm not quite ready yet though!", +}; \ No newline at end of file diff --git a/asher/src/routines/client-ready/startup-send-message/startupSendMessage.js b/asher/src/routines/client-ready/startup-send-message/startupSendMessage.js new file mode 100644 index 0000000..e97eaa0 --- /dev/null +++ b/asher/src/routines/client-ready/startup-send-message/startupSendMessage.js @@ -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); +} \ No newline at end of file diff --git a/asher/src/routines/routineManifest.js b/asher/src/routines/routineManifest.js index 010cb7f..153bbc7 100644 --- a/asher/src/routines/routineManifest.js +++ b/asher/src/routines/routineManifest.js @@ -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, ], }, ]; \ No newline at end of file diff --git a/asher/src/secrets.js b/asher/src/secrets.js index 7349932..0fd6262 100644 --- a/asher/src/secrets.js +++ b/asher/src/secrets.js @@ -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 = {}; diff --git a/docker-compose.yml b/docker-compose.yml index 08b05b7..07741f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,11 @@ services: command: bash -c "cd /asher && npm i && npm run serve" secrets: - botkey + - default-channel secrets: botkey: - file: ./botkey.txt \ No newline at end of file + file: ./botkey.txt + default-channel: + file: ./defaultchannel.txt \ No newline at end of file