add some debug fuckery

This commit is contained in:
Christopher Cookman 2023-03-12 21:00:40 -06:00
parent 0e6dd5fb96
commit 19ce0b0c0a
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
2 changed files with 36 additions and 1 deletions

View file

@ -8,5 +8,22 @@
"name": "info", "name": "info",
"description": "Info about the current session", "description": "Info about the current session",
"type": 1 "type": 1
},
{
"name": "debug",
"description": "Uploads some debug information",
"type": 1,
"options": [
{
"name": "config",
"description": "Upload the config file",
"type": 5
},
{
"name": "client",
"description": "Upload the client object",
"type": 5
}
]
} }
] ]

View file

@ -151,6 +151,20 @@ client.on('interactionCreate', async (interaction) => {
}); });
} }
break; break;
case "debug": // Upload debug info such as the session
// Generate files array based on options
var files = [];
if (interaction.options.getBoolean("config")) files.push({name: "config.json", attachment: Buffer.from(JSON.stringify(config, null, "\t"))});
if (interaction.options.getBoolean("client")) files.push({name: "client.json", attachment: Buffer.from(JSON.stringify(client, null, "\t"))});
// if the object size of sessions isn't 0, push the sessions file
if (Object.keys(sessions).length !== 0) files.push({name: "sessions.json", attachment: Buffer.from(JSON.stringify(sessions, null, "\t"))});
// Upload the session
interaction.reply({
content: files.length == 0 ? "No files to upload." : null,
ephemeral: true,
files: files
});
} }
}); });
@ -273,7 +287,11 @@ if (fs.existsSync(path.join(__dirname, "modPrompt.txt"))) {
basePrompt.content = fs.readFileSync("./basePrompt.txt", "utf8").toString(); basePrompt.content = fs.readFileSync("./basePrompt.txt", "utf8").toString();
} }
var nsfwPrompt = {"role": "system", "name": "System", "content": fs.readFileSync("./nsfwPrompt.txt", "utf8").toString()}; // NSFW prompt for NSFW channels var nsfwPrompt = {
"role": "system",
"name": "System",
"content": fs.readFileSync("./nsfwPrompt.txt", "utf8").toString()
}; // NSFW prompt for NSFW channels
// Handle SIGINT gracefully // Handle SIGINT gracefully
process.on('SIGINT', async () => { process.on('SIGINT', async () => {