make pretty
This commit is contained in:
parent
40e865521d
commit
fd92269e3c
22
llamabot.js
22
llamabot.js
@ -1,8 +1,14 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const emptyResponses = require('./assets/emptyMessages.js');
|
const emptyResponses = require('./assets/emptyMessages.js');
|
||||||
const { resetResponses, userResetMessages } = require('./assets/resetMessages.js');
|
const {
|
||||||
const { errorMessages, busyResponses } = require('./assets/errorMessages.js');
|
resetResponses,
|
||||||
|
userResetMessages
|
||||||
|
} = require('./assets/resetMessages.js');
|
||||||
|
const {
|
||||||
|
errorMessages,
|
||||||
|
busyResponses
|
||||||
|
} = require('./assets/errorMessages.js');
|
||||||
|
|
||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
|
|
||||||
@ -33,7 +39,9 @@ function setBusy(userId, isBusy) {
|
|||||||
if (conversations.has(userId)) {
|
if (conversations.has(userId)) {
|
||||||
conversations.get(userId).busy = isBusy;
|
conversations.get(userId).busy = isBusy;
|
||||||
} else {
|
} else {
|
||||||
conversations.set(userId, { busy: isBusy });
|
conversations.set(userId, {
|
||||||
|
busy: isBusy
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,13 +79,11 @@ function setPresenceOnline() {
|
|||||||
client.once('ready', () => {
|
client.once('ready', () => {
|
||||||
console.log('Bot is ready.');
|
console.log('Bot is ready.');
|
||||||
|
|
||||||
setPresenceOnline()
|
setPresenceOnline()
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('messageCreate', async (message) => {
|
client.on('messageCreate', async (message) => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function sendRand(array) {
|
async function sendRand(array) {
|
||||||
const arrayChoice = array[Math.floor(Math.random() * array.length)];
|
const arrayChoice = array[Math.floor(Math.random() * array.length)];
|
||||||
await message.channel.send(arrayChoice); // give a notification of reset using a human like response.
|
await message.channel.send(arrayChoice); // give a notification of reset using a human like response.
|
||||||
@ -108,9 +114,6 @@ client.on('messageCreate', async (message) => {
|
|||||||
busy: false
|
busy: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (conversation.messages.length === 0) {
|
if (conversation.messages.length === 0) {
|
||||||
conversation.messages.push({
|
conversation.messages.push({
|
||||||
role: 'user',
|
role: 'user',
|
||||||
@ -222,5 +225,4 @@ async function generateResponse(conversation) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
client.login(process.env.THE_TOKEN); // Replace with your bot token
|
client.login(process.env.THE_TOKEN); // Replace with your bot token
|
Loading…
Reference in New Issue
Block a user