Compare commits
7 Commits
98c1e83770
...
0811bfbde9
Author | SHA1 | Date |
---|---|---|
Matthew | 0811bfbde9 | |
Matthew | 1e2b777672 | |
Matthew | 1940d49884 | |
Matthew | e6b8291b2a | |
Matthew | 6e6ebacf57 | |
Matthew | 026f5fb47f | |
Matthew | 9d710dc0db |
|
@ -1,9 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DiscordProjectSettings">
|
|
||||||
<option name="show" value="ASK" />
|
|
||||||
<option name="description" value="" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager">
|
<component name="ProjectRootManager">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -62,7 +62,12 @@ export default class Partner implements SharedMemberAttributes {
|
||||||
public title: PartnerTitle | "Partner" | undefined;
|
public title: PartnerTitle | "Partner" | undefined;
|
||||||
|
|
||||||
@prop()
|
@prop()
|
||||||
|
//
|
||||||
public directReport: Partner | string | undefined;
|
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);
|
export const PartnerModel = getModelForClass(Partner);
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
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") {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 });
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -73,7 +73,7 @@ export default class Whois extends DiscordInteractionCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
embed.setColor(guildMember.displayColor);
|
embed.setColor(guildMember.displayColor);
|
||||||
embed.setDescription(embedDescription);
|
if (embedDescription?.length > 0) embed.setDescription(embedDescription);
|
||||||
embed.setFooter({ text: `Discord ID: ${guildMember.id}${databaseMember ? `Internal ID: ${databaseMember?._id}` : ''}` });
|
embed.setFooter({ text: `Discord ID: ${guildMember.id}${databaseMember ? `Internal ID: ${databaseMember?._id}` : ''}` });
|
||||||
|
|
||||||
return await interaction.editReply({ embeds: [embed] });
|
return await interaction.editReply({ embeds: [embed] });
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
|
export { default as Partner } from "./Partner";
|
||||||
export { default as Ping } from "./Ping";
|
export { default as Ping } from "./Ping";
|
||||||
export { default as Whois } from "./Whois";
|
export { default as Whois } from "./Whois";
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js";
|
import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js";
|
||||||
import { guildID } from "../config.json";
|
import { guildID } from "../config.json";
|
||||||
|
|
||||||
export default abstract class DiscordInteractionCommand {
|
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 {
|
||||||
public name: string;
|
public name: string;
|
||||||
public description: string;
|
public description: string;
|
||||||
public builder: SlashCommandBuilder;
|
public builder: SlashCommandBuilder;
|
||||||
|
|
||||||
protected GUILD_ID: string;
|
public GUILD_ID: string;
|
||||||
|
|
||||||
protected constructor(name: string, description: string) {
|
protected constructor(name: string, description: string) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -64,19 +64,22 @@ export default class MemberUtil {
|
||||||
// if the role type is managerial, add a [k] to the end of the name
|
// 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 the partner exists, set the iconURL to the organizational logo
|
||||||
if (partner?.roleType == PartnerRoleType.MANAGERIAL) {
|
if (partner?.roleType == PartnerRoleType.MANAGERIAL) {
|
||||||
|
console.log(`[MemberUtil] Formatting name for ${target.displayName}`)
|
||||||
return {
|
return {
|
||||||
text: `${target.displayName} [k]`,
|
text: `${target.displayName} [k]`,
|
||||||
iconURL: "https://static.libraryofcode.org/library_of_code_redeg.png"
|
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
|
} 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 {
|
return {
|
||||||
text: `${target.displayName} [c]`,
|
text: `${target.displayName} [c]`,
|
||||||
iconURL: "https://static.libraryofcode.org/library_of_code_redeg.png"
|
iconURL: "https://static.libraryofcode.org/library_of_code_redeg.png"
|
||||||
}
|
}
|
||||||
} else { // otherwise, just set the author to the member's display name
|
} 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 {
|
return {
|
||||||
text: target.displayName,
|
text: target.displayName,
|
||||||
iconURL: target.displayAvatarURL()
|
iconURL: target instanceof GuildMember ? target.user.displayAvatarURL() : target.displayAvatarURL()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue