1
0
Fork 0

fix attempt x3

pull/1/head
Matthew 2024-01-07 13:45:25 -05:00
parent a2e9a87e69
commit 7337f77027
Signed by: matthew
SSH Key Fingerprint: SHA256:piIXekA9q1p0ZGi4ogFbNY1embip5Ytbi3v8AZ8UYq4
1 changed files with 3 additions and 2 deletions

View File

@ -316,11 +316,12 @@ export default class Util {
} }
public async getTechnicianName(tech: User, format: TechnicianNameFormatOpt = TechnicianNameFormatOpt.Full) { public async getTechnicianName(tech: User, format: TechnicianNameFormatOpt = TechnicianNameFormatOpt.Full) {
if (!tech) return 'SYSTEM (U)'; if (!tech) return 'SYSTEM (UT)';
if (tech.id === this.client.user.id) return 'SYSTEM (S)'; if (tech.id === this.client.user.id) return 'SYSTEM (SELF)';
const req = await axios.get('https://loc.sh/int/directory'); const req = await axios.get('https://loc.sh/int/directory');
const find = req.data.find((mem) => mem.userID === tech.id); const find = req.data.find((mem) => mem.userID === tech.id);
if (!find) return 'SYSTEM (UF)';
if (format === TechnicianNameFormatOpt.Full) { if (format === TechnicianNameFormatOpt.Full) {
return `${tech.username}${find.isManager ? ' [k]' : ''}${find.title ? ` (${find.title} / ${find.dept})` : ` (${find.dept})`} <<@${tech.id}>>`; return `${tech.username}${find.isManager ? ' [k]' : ''}${find.title ? ` (${find.title} / ${find.dept})` : ` (${find.dept})`} <<@${tech.id}>>`;
} else if (format === TechnicianNameFormatOpt.Partial) { } else if (format === TechnicianNameFormatOpt.Partial) {