Update
This commit is contained in:
parent
2c087c2943
commit
56dcc67ea2
1 changed files with 35 additions and 18 deletions
|
@ -333,6 +333,23 @@ function restartBot() {
|
||||||
process.exit(0); // Exits the current process, assuming your process manager restarts the bot
|
process.exit(0); // Exits the current process, assuming your process manager restarts the bot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const { exec } = require('child_process');
|
||||||
|
|
||||||
|
// Function to restart the bot
|
||||||
|
function restartBot() {
|
||||||
|
console.log("Restarting bot...");
|
||||||
|
process.exit(0); // Exits the current process, assuming your process manager restarts the bot
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to save conversation for self-learning
|
||||||
|
function saveConversation(conversation) {
|
||||||
|
// Implement the logic to save the conversation
|
||||||
|
// For example, you can write it to a file or a database
|
||||||
|
const data = JSON.stringify(conversation, null, 2);
|
||||||
|
fs.appendFileSync('conversations.json', data + ',\n');
|
||||||
|
}
|
||||||
|
|
||||||
// Before sending the response, check for mentions
|
// Before sending the response, check for mentions
|
||||||
if (!fullAnswer.includes('@everyone') && !fullAnswer.includes('@here') && !fullAnswer.includes('@')) {
|
if (!fullAnswer.includes('@everyone') && !fullAnswer.includes('@here') && !fullAnswer.includes('@')) {
|
||||||
if (fullAnswer.length <= 2000) {
|
if (fullAnswer.length <= 2000) {
|
||||||
|
@ -361,7 +378,6 @@ if (!fullAnswer.includes('@everyone') && !fullAnswer.includes('@here') && !fullA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Save the conversation for self-learning
|
// Save the conversation for self-learning
|
||||||
const conversation = {
|
const conversation = {
|
||||||
user: message.author.id,
|
user: message.author.id,
|
||||||
|
@ -371,7 +387,7 @@ if (!fullAnswer.includes('@everyone') && !fullAnswer.includes('@here') && !fullA
|
||||||
saveConversation(conversation);
|
saveConversation(conversation);
|
||||||
|
|
||||||
conversations.set(message.author.id, messages.concat([{ "role": "assistant", "content": fullAnswer }]));
|
conversations.set(message.author.id, messages.concat([{ "role": "assistant", "content": fullAnswer }]));
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(chalk.bold.redBright(error));
|
console.error(chalk.bold.redBright(error));
|
||||||
|
|
||||||
|
@ -385,6 +401,7 @@ if (!fullAnswer.includes('@everyone') && !fullAnswer.includes('@here') && !fullA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Command Handler
|
// Command Handler
|
||||||
if (message.content.toLowerCase().startsWith(config.Prefix)) {
|
if (message.content.toLowerCase().startsWith(config.Prefix)) {
|
||||||
const neededPermissions = [
|
const neededPermissions = [
|
||||||
|
|
Loading…
Reference in a new issue