code cleanup
This commit is contained in:
parent
24cf2323a3
commit
a8c1138ad7
@ -1,21 +1,15 @@
|
|||||||
const { EmbedBuilder } = require('discord.js');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
let cpu = require('cpu-load')
|
m
|
||||||
|
odule.exports = {
|
||||||
module.exports = {
|
|
||||||
name: "about",
|
name: "about",
|
||||||
description: "Info about the bot",
|
description: "Info about the bot",
|
||||||
|
|
||||||
run: async (client, interaction) => {
|
run: async (client, interaction) => {
|
||||||
cpu(1000, function (load) {
|
const embed = new EmbedBuilder()
|
||||||
|
.setColor("#FF0000")
|
||||||
const embed = new EmbedBuilder()
|
.setTitle("About rAI")
|
||||||
.setColor("#FF0000")
|
.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`)
|
||||||
.setTitle("About rAI")
|
.setTimestamp()
|
||||||
.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`)
|
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
|
||||||
.setTimestamp()
|
interaction.followUp({ embeds: [embed] });
|
||||||
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
|
|
||||||
interaction.followUp({ embeds: [embed] });
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -13,16 +13,15 @@ module.exports = {
|
|||||||
"required": true,
|
"required": true,
|
||||||
"type": 3 // 6 is type USER
|
"type": 3 // 6 is type USER
|
||||||
}],
|
}],
|
||||||
|
|
||||||
run: async (client, interaction) => {
|
run: async (client, interaction) => {
|
||||||
const file = './cache/' + interaction.user.id;
|
const file = './cache/' + interaction.user.id;
|
||||||
let chatToSend = interaction.options._hoistedOptions[0].value;
|
let chatToSend = interaction.options._hoistedOptions[0].value;
|
||||||
|
|
||||||
// Check if another request is already being processed
|
// Check if another request is already being processed
|
||||||
if (isProcessing) {
|
if (isProcessing) {
|
||||||
interaction.editReply('Sorry, another request is already being processed. Please try again in a few minutes.');
|
interaction.editReply('Sorry, another request is already being processed. Please try again in a few minutes.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the semaphore to true
|
// Set the semaphore to true
|
||||||
isProcessing = true;
|
isProcessing = true;
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ module.exports = {
|
|||||||
sendImmediately: true
|
sendImmediately: true
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
// console.log(response)
|
|
||||||
const obj = { id: response.body }
|
const obj = { id: response.body }
|
||||||
|
|
||||||
jsonfile.writeFile(file, obj, function (err) {
|
jsonfile.writeFile(file, obj, function (err) {
|
||||||
|
@ -11,8 +11,6 @@ module.exports = {
|
|||||||
|
|
||||||
jsonfile.readFile(file, function (err, obj) {
|
jsonfile.readFile(file, function (err, obj) {
|
||||||
if (err) return interaction.editReply('Please create a session using /create-session.');
|
if (err) return interaction.editReply('Please create a session using /create-session.');
|
||||||
console.dir(obj)
|
|
||||||
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setColor("#FF0000")
|
.setColor("#FF0000")
|
||||||
|
@ -2,7 +2,6 @@ const axios = require('axios');
|
|||||||
const jsonfile = require('jsonfile');
|
const jsonfile = require('jsonfile');
|
||||||
let session2;
|
let session2;
|
||||||
|
|
||||||
|
|
||||||
function parseQuestionsAndAnswers(jsonStr) {
|
function parseQuestionsAndAnswers(jsonStr) {
|
||||||
const obj = JSON.parse(jsonStr);
|
const obj = JSON.parse(jsonStr);
|
||||||
const questions = obj.questions;
|
const questions = obj.questions;
|
||||||
@ -16,8 +15,8 @@ module.exports = {
|
|||||||
run: async (client, interaction) => {
|
run: async (client, interaction) => {
|
||||||
const file = './cache/' + interaction.user.id;
|
const file = './cache/' + interaction.user.id;
|
||||||
|
|
||||||
|
|
||||||
await jsonfile.readFile(file, async function (err, session) {
|
await jsonfile.readFile(file, async function (err, session) {
|
||||||
|
|
||||||
if (err) return interaction.editReply('Please create a session using /create-session.');
|
if (err) return interaction.editReply('Please create a session using /create-session.');
|
||||||
|
|
||||||
session2 = session.id;
|
session2 = session.id;
|
||||||
|
Loading…
Reference in New Issue
Block a user