From 6e6ebacf57f25d3795175bcea8deb963c661ebaf Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 5 Apr 2024 20:12:32 -0400 Subject: [PATCH] partner add subcommand (unfinished) --- discord/commands/PartnerAdd.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 discord/commands/PartnerAdd.ts 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 }); + + } +}