remove unready file

This commit is contained in:
SowinskiBraeden committed 2022-10-16 13:12:04 -07:00
1 parent dad2cddf61
commit dc7a724d7a
1 file changed
-137
-137
View File
@@ -1,137 +0,0 @@
const { EmbedBuilder } = require('discord.js');
const { Invoice, addInvoiceList, addInvoice } = require('../structures/invoice');
module.exports = {
name: "invoice",
debug: false,
description: "handle invoices",
usage: "[cmd] [opt]",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
options: [
{
name: "list",
description: "list invoices that have been sent to you",
value: "list",
type: 1,
},
{
name: "create",
description: "send an invoice to a user",
value: "create",
type: 1,
options: [
{
name: "title",
description: "title of the invoice",
value: "title",
type: 3,
required: true,
},
{
name: "description",
description: "description of the invoice",
value: "description",
type: 3,
required: true,
},
{
name: "user",
description: "user to send invoice to",
value: "user",
type: 6,
required: true,
},
{
name: "fee",
description: "the amount due for this invoice",
value: "fee",
type: 10,
min_value: 0.01,
required: true,
}
]
}
],
SlashCommand: {
/**
*
* @param {require("../structures/QuarksBot")} client
* @param {import("discord.js").MessageCreate} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }) => {
if (GuildDB.customChannelStatus && !GuildDB.allowedChannels.includes(interaction.channel_id)) {
return interaction.send(`You are not allowed to use the bot in this channel.`);
}
if (args[0].name == 'list') {
console.log('list');
} else if (args[0].name == 'create') {
if (!client.exists(GuildDB.commercialRole)) {
let embed = new EmbedBuilder()
.setColor(client.config.Colors.Yellow)
.setTitle("Notice:")
.setDescription("An admin needs to configure the commercial role in order for this command to be used.");
return interaction.send({ embeds: [embed] });
}
if (!interaction.member.roles.includes(GuildDB.commercialRole)) {
let embed = new EmbedBuilder()
.setColor(client.config.Colors.Yellow)
.setDescription(`**Notice:** You require the <@&${GuildDB.commercialRole}> role`)
return interaction.send({ embeds: [embed] });
}
let invoices = await client.dbo.collection("invoices").findOne({"invoiceDB.userID": args[0].options[2].value}).then(invoices => invoices);
if (!invoices) {
invoices = {
userID: args[0].options[2].value,
guilds: {}
};
invoices.guilds[GuildDB.serverID] = { invoices: [] };
// Register invoiceDB for user
let newInvoice = new Invoice();
newInvoice.createInvoiceDB(args[0].options[2].value, GuildDB.serverID);
newInvoice.save().catch(err => {
if (err) return client.sendInternalError(interaction, err);
});
} else invoices = invoices.invoiceDB;
if (!client.exists(invoices.guilds[GuildDB.serverID])) {
let success = addInvoiceList(invoices.guilds, GuildDB.serverID, args[0].options[2].value, client);
if (!success) return client.sendInternalError(interaction, 'Failed to add invoice list');
}
let ID = Math.floor(100000 + Math.random() * 900000);
let invoice = {
id: ID,
name: args[0].options[0].value,
description: args[0].options[1].value,
amount: args[0].options[3].value,
to: args[0].options[2].value,
from: interaction.member.user.id,
paid: false
};
let success = addInvoice(GuildDB.serverID, args[0].options[2].value, invoice, client);
if (!success) return client.sendInternalError(interaction, 'Failed to add invoice to user');
let successEmbed = new EmbedBuilder()
.setTitle("Success")
.setDescription(`Successfully sent invoice **${ID}** to <@${args[0].options[2].value}>`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successEmbed] });
}
},
},
}