code cleanup

This commit is contained in:
Raven Scott 2023-03-25 19:50:48 +02:00
parent 24cf2323a3
commit a8c1138ad7
5 changed files with 11 additions and 22 deletions

View File

@ -1,21 +1,15 @@
const { EmbedBuilder } = require('discord.js');
let cpu = require('cpu-load')
module.exports = {
m
odule.exports = {
name: "about",
description: "Info about the bot",
run: async (client, interaction) => {
cpu(1000, function (load) {
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle("About rAI")
.setDescription(`Latency : ${client.ws.ping}ms\n\nrAI is a bot managed by \`snxraven#8205\` running an LLM called Alpaca.\n\nSpecs: Intel i7-1065G7 (8) @ 3.900GHz with 11 GB of RAM\nChat is set to 7 Threads\nConfigured Memory Speed: 3733 MT/s\nUSB Liveboot\n\nSingle Task Only - 256 Max Token Output`)
.setTimestamp()
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
interaction.followUp({ embeds: [embed] });
})
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle("About rAI")
.setDescription(`Latency : ${client.ws.ping}ms\n\nrAI is a bot managed by \`snxraven#8205\` running an LLM called Alpaca.\n\nSpecs: Intel i7-1065G7 (8) @ 3.900GHz with 11 GB of RAM\nChat is set to 7 Threads\nConfigured Memory Speed: 3733 MT/s\nUSB Liveboot\n\nSingle Task Only - 256 Max Token Output`)
.setTimestamp()
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
interaction.followUp({ embeds: [embed] });
},
};

View File

@ -13,16 +13,15 @@ module.exports = {
"required": true,
"type": 3 // 6 is type USER
}],
run: async (client, interaction) => {
const file = './cache/' + interaction.user.id;
let chatToSend = interaction.options._hoistedOptions[0].value;
// Check if another request is already being processed
if (isProcessing) {
interaction.editReply('Sorry, another request is already being processed. Please try again in a few minutes.');
return;
}
// Set the semaphore to true
isProcessing = true;

View File

@ -18,7 +18,6 @@ module.exports = {
sendImmediately: true
})
.then((response) => {
// console.log(response)
const obj = { id: response.body }
jsonfile.writeFile(file, obj, function (err) {

View File

@ -11,8 +11,6 @@ module.exports = {
jsonfile.readFile(file, function (err, obj) {
if (err) return interaction.editReply('Please create a session using /create-session.');
console.dir(obj)
const embed = new EmbedBuilder()
.setColor("#FF0000")

View File

@ -2,7 +2,6 @@ const axios = require('axios');
const jsonfile = require('jsonfile');
let session2;
function parseQuestionsAndAnswers(jsonStr) {
const obj = JSON.parse(jsonStr);
const questions = obj.questions;
@ -16,8 +15,8 @@ module.exports = {
run: async (client, interaction) => {
const file = './cache/' + interaction.user.id;
await jsonfile.readFile(file, async function (err, session) {
if (err) return interaction.editReply('Please create a session using /create-session.');
session2 = session.id;