Added message on boot
This commit is contained in:
parent
1542820f89
commit
38cbb0b961
3
.gitignore
vendored
3
.gitignore
vendored
@ -130,4 +130,5 @@ dist
|
||||
.pnp.*
|
||||
|
||||
# secrets
|
||||
botkey.txt
|
||||
botkey.txt
|
||||
defaultchannel.txt
|
||||
3
asher/src/constants.js
Normal file
3
asher/src/constants.js
Normal file
@ -0,0 +1,3 @@
|
||||
export const textStrings = {
|
||||
BOOT_MESSAGE: "Hi! Chloe just started me up! I'm not quite ready yet though!",
|
||||
};
|
||||
@ -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);
|
||||
}
|
||||
@ -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,
|
||||
],
|
||||
},
|
||||
];
|
||||
@ -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 = {};
|
||||
|
||||
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user