forked from engineering/crv2
formatting todo comment
parent
3e80cba3c1
commit
754983ab08
|
@ -6,7 +6,7 @@ import Partner, {
|
||||||
PartnerTitle
|
PartnerTitle
|
||||||
} from "../database/Partner";
|
} from "../database/Partner";
|
||||||
import Member, { MemberAdditionalAcknowledgement, MemberModel } from "../database/Member";
|
import Member, { MemberAdditionalAcknowledgement, MemberModel } from "../database/Member";
|
||||||
import { Client } from "discord.js";
|
import { Client, GuildMember, User } from "discord.js";
|
||||||
import { guildID } from "../config.json";
|
import { guildID } from "../config.json";
|
||||||
|
|
||||||
export interface PartnerOptions {
|
export interface PartnerOptions {
|
||||||
|
@ -17,6 +17,11 @@ export interface PartnerOptions {
|
||||||
directReport: Partner | string;
|
directReport: Partner | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface FormatNameOptions {
|
||||||
|
text: string;
|
||||||
|
iconURL: string;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Add the rest of the remaining role configurations
|
// TODO: Add the rest of the remaining role configurations
|
||||||
export const PartnerDiscordRoleMap = {
|
export const PartnerDiscordRoleMap = {
|
||||||
// Director of Engineering, Management, Staff, Technician, Core Team, Play Caller
|
// Director of Engineering, Management, Staff, Technician, Core Team, Play Caller
|
||||||
|
@ -53,4 +58,26 @@ export default class MemberUtil {
|
||||||
if (member.additionalAcknowledgement?.includes(acknowledgement)) throw new Error("This member already has this acknowledgement.")
|
if (member.additionalAcknowledgement?.includes(acknowledgement)) throw new Error("This member already has this acknowledgement.")
|
||||||
return MemberModel.updateOne({ discordID: member.discordID }, { $push: { additionalAcknowledgement: acknowledgement } });
|
return MemberModel.updateOne({ discordID: member.discordID }, { $push: { additionalAcknowledgement: acknowledgement } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: comments and extended formatting
|
||||||
|
public static formatName(target: GuildMember | User, partner?: Partner | null): FormatNameOptions {
|
||||||
|
// 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) {
|
||||||
|
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
|
||||||
|
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
|
||||||
|
return {
|
||||||
|
text: target.displayName,
|
||||||
|
iconURL: target.displayAvatarURL()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue