add some debug fuckery
This commit is contained in:
parent
0e6dd5fb96
commit
19ce0b0c0a
|
@ -8,5 +8,22 @@
|
|||
"name": "info",
|
||||
"description": "Info about the current session",
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
20
index.js
20
index.js
|
@ -151,6 +151,20 @@ client.on('interactionCreate', async (interaction) => {
|
|||
});
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
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
|
||||
process.on('SIGINT', async () => {
|
||||
|
|
Loading…
Reference in a new issue