adding .env

This commit is contained in:
Raven Scott 2024-06-04 01:36:45 -04:00
parent c293e3b5e7
commit 378aeb7469
3 changed files with 10 additions and 3 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules
package-lock.json
shared-storage
storage
chatBot/.env

View File

@ -1,13 +1,14 @@
import fs from 'fs';
import path from 'path';
import chatBot from './includes/chatBot.js'; // Adjust the import path as necessary
import 'dotenv/config'
// Generate a Buffer from the hexadecimal topic value
const topicHex = '669c83fa3c559f2c330f71a34e351a9134cecc6c255e4ef7689177bf0d7fd52a';
const topicHex = process.env.LINKUP_ROOM_ID;
const topicBuffer = Buffer.from(topicHex, 'hex');
// Create a new instance of the chatBot class with a valid botName
const botName = 'MyBot'; // Replace 'MyBot' with the desired bot name
const botName = process.env.BOT_NAME;; // Replace 'MyBot' with the desired bot name
// Load commands from the 'commands' directory
const commandsDir = path.join(new URL('./commands/', import.meta.url).pathname);
@ -65,7 +66,7 @@ loadCommands().then(commands => {
// Wait for 2 seconds for the bot to connect
setTimeout(() => {
// Send a message
bot.sendMessage('Hello, world!');
bot.sendMessage(process.env.ON_READY_MESSAGE);
}, 2000); // Adjust the delay as necessary
}).catch(error => {
console.error('Error loading commands:', error);

5
chatBot/env.default Normal file
View File

@ -0,0 +1,5 @@
LINKUP_ROOM_ID=
BOT_NAME=myBot
ON_READY_MESSAGE="Hello, I am a bot. I am here to help you. Please type 'help' to see the list of commands."