Compare commits

..

No commits in common. "0811bfbde9f8bce95cbdff3bac9e8ffe61faa3cc" and "98c1e8377031d514f08c5803a4e1acb2c8b27405" have entirely different histories.

8 changed files with 8 additions and 59 deletions

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>

View File

@ -62,12 +62,7 @@ export default class Partner implements SharedMemberAttributes {
public title: PartnerTitle | "Partner" | undefined;
@prop()
//
public directReport: Partner | string | undefined;
@prop()
// this field dictates if the partner is able to perform developer commands, such as "eval"
public canPerformDevCommands: boolean | undefined;
}
export const PartnerModel = getModelForClass(Partner);

View File

@ -1,13 +0,0 @@
import DiscordInteractionCommand from "../../util/DiscordInteractionCommand";
import { ChatInputCommandInteraction } from "discord.js";
export default class Ping extends DiscordInteractionCommand {
constructor() {
super("partner", "Manipulates partner information.");
}
public async execute(interaction: ChatInputCommandInteraction): Promise<void> {
if (interaction.options?.getSubcommand(true) === "add") {
}
}
}

View File

@ -1,25 +0,0 @@
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 });
}
}

View File

@ -73,7 +73,7 @@ export default class Whois extends DiscordInteractionCommand {
}
}
embed.setColor(guildMember.displayColor);
if (embedDescription?.length > 0) embed.setDescription(embedDescription);
embed.setDescription(embedDescription);
embed.setFooter({ text: `Discord ID: ${guildMember.id}${databaseMember ? `Internal ID: ${databaseMember?._id}` : ''}` });
return await interaction.editReply({ embeds: [embed] });

View File

@ -1,3 +1,2 @@
export { default as Partner } from "./Partner";
export { default as Ping } from "./Ping";
export { default as Whois } from "./Whois";

View File

@ -1,20 +1,12 @@
import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js";
import { guildID } from "../config.json";
export interface DiscordInteractionCommandSkeleton {
GUILD_ID: string;
builder?: SlashCommandBuilder;
description: string;
execute: (interaction: ChatInputCommandInteraction) => Error | Promise<void | any>;
name: string;
}
export default abstract class DiscordInteractionCommand implements DiscordInteractionCommandSkeleton {
export default abstract class DiscordInteractionCommand {
public name: string;
public description: string;
public builder: SlashCommandBuilder;
public GUILD_ID: string;
protected GUILD_ID: string;
protected constructor(name: string, description: string) {
this.name = name;

View File

@ -64,22 +64,19 @@ export default class MemberUtil {
// if the role type is managerial, add a [k] to the end of the name
// if the partner exists, set the iconURL to the organizational logo
if (partner?.roleType == PartnerRoleType.MANAGERIAL) {
console.log(`[MemberUtil] Formatting name for ${target.displayName}`)
return {
text: `${target.displayName} [k]`,
iconURL: "https://static.libraryofcode.org/library_of_code_redeg.png"
}
} else if (partner?.commissionType == PartnerCommissionType.CONTRACTUAL) { // if the commission type is contractual, add a [c] to the end of the name
console.log(`[MemberUtil] Formatting name for ${target.displayName}`)
return {
text: `${target.displayName} [c]`,
iconURL: "https://static.libraryofcode.org/library_of_code_redeg.png"
}
} else { // otherwise, just set the author to the member's display name
console.log(`[MemberUtil] Formatting name for ${target.displayName} at url ${target instanceof GuildMember ? target.user.displayAvatarURL() : target.displayAvatarURL()}`);
return {
text: target.displayName,
iconURL: target instanceof GuildMember ? target.user.displayAvatarURL() : target.displayAvatarURL()
iconURL: target.displayAvatarURL()
}
}
}