Initial Emmelia merge
This commit is contained in:
27
Server/commands/category.js
Normal file
27
Server/commands/category.js
Normal file
@@ -0,0 +1,27 @@
|
||||
var libCore = require("../libCore.js");
|
||||
const { SlashCommandBuilder } = require('discord.js');
|
||||
const { DebugBuilder } = require("../utilities/debugBuilder");
|
||||
const log = new DebugBuilder("server", "categories");
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('categories')
|
||||
.setDescription('Return all categories'),
|
||||
example: "categories",
|
||||
isPrivileged: false,
|
||||
async execute(interaction) {
|
||||
await libCore.getCategories(async (err, categoryResults) => {
|
||||
if (err) throw err;
|
||||
|
||||
log.DEBUG("Returned Categories: ", categoryResults);
|
||||
var categories = [];
|
||||
for (const record of categoryResults) {
|
||||
categories.push(record.category);
|
||||
}
|
||||
|
||||
await interaction.reply(
|
||||
`Categories: [${categories}]`
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user