Moving ChannelID list to .env, Parsing array instead of checking both vars
This commit is contained in:
parent
8eb1b34d4e
commit
d90ceab967
@ -1,5 +1,4 @@
|
|||||||
THE_TOKEN = "DISCORD_TOKEN_HERE"
|
THE_TOKEN = "DISCORD_TOKEN_HERE"
|
||||||
CHANNEL_ID = CHANNEL_ID_HERE
|
CHANNEL_IDS = 1094494101631680653,1094628334727614605
|
||||||
CHANNEL_ID_2 = CHANNEL_ID_HERE
|
|
||||||
ROOT_IP = 192.168.0.15
|
ROOT_IP = 192.168.0.15
|
||||||
ROOT_PORT = 8000
|
ROOT_PORT = 8000
|
11
llamabot.js
11
llamabot.js
@ -24,8 +24,8 @@ const client = new Client({
|
|||||||
partials: [Partials.Channel],
|
partials: [Partials.Channel],
|
||||||
});
|
});
|
||||||
|
|
||||||
const channelID = '1094494101631680653'; // Replace with your channel ID
|
// Grab ChannelIDs from the .env file
|
||||||
const channelID2 = '1094628334727614605'; // Replace with your channel ID
|
const channelIDs = process.env.CHANNEL_IDS.split(',');
|
||||||
|
|
||||||
const conversations = new Map();
|
const conversations = new Map();
|
||||||
|
|
||||||
@ -88,9 +88,10 @@ client.on('messageCreate', async (message) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only respond in the specified channels
|
// Only respond in the specified channels
|
||||||
if (message.channel.id !== channelID && message.channel.id !== channelID2) {
|
if (!channelIDs.includes(message.channel.id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.author.bot) return; // Ignore messages from bots
|
if (message.author.bot) return; // Ignore messages from bots
|
||||||
|
|
||||||
// Check if any conversation is busy
|
// Check if any conversation is busy
|
||||||
@ -110,11 +111,11 @@ client.on('messageCreate', async (message) => {
|
|||||||
if (conversation.messages.length === 0) {
|
if (conversation.messages.length === 0) {
|
||||||
conversation.messages.push({
|
conversation.messages.push({
|
||||||
role: 'user',
|
role: 'user',
|
||||||
content: `You are rAi, the most helpful writing AI, you code and write without any mistakes.`
|
content: `You are rAi, the most helpful writing AI, you code, write and provide information without any mistakes.`
|
||||||
});
|
});
|
||||||
conversation.messages.push({
|
conversation.messages.push({
|
||||||
role: 'user',
|
role: 'user',
|
||||||
content: `My name is ${message.author.username}.`
|
content: `My name is ${message.author.username}. \nIf you address me, tag me using @${message.author.username}`
|
||||||
});
|
});
|
||||||
conversation.messages.push({
|
conversation.messages.push({
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
|
Loading…
Reference in New Issue
Block a user