diff --git a/discord/commands/PartnerAdd.ts b/discord/commands/PartnerAdd.ts new file mode 100644 index 0000000..d79df4e --- /dev/null +++ b/discord/commands/PartnerAdd.ts @@ -0,0 +1,25 @@ +import DiscordInteractionCommand, { DiscordInteractionCommandSkeleton } from "../../util/DiscordInteractionCommand"; +import { guildID } from "../../config.json"; +import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js"; +import { MemberModel } from "../../database/Member"; +import { PartnerModel } from "../../database/Partner"; + +export default class PartnerAdd implements DiscordInteractionCommandSkeleton { + public GUILD_ID: string; + public name: string; + public description: string + public builder: SlashCommandBuilder; + constructor() { + this.name = "partner"; + this.description = "Creates a new partner entry."; + this.builder = new SlashCommandBuilder(); + this.GUILD_ID = guildID; + } + + public async execute(interaction: ChatInputCommandInteraction) { + const member = MemberModel.findOne({ discordID: interaction.user.id }); + if (!member) return interaction.reply({ content: "The specified partner does not have a base member entry.", ephemeral: true }); + if (!(await PartnerModel.findOne({discordID: interaction.user.id}))) return interaction.reply({ content: "The specified partner already has a partner entry.", ephemeral: true }); + + } +}