From 679f76e2511a66b08ec51262ad0291278e3790be Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sun, 18 Apr 2021 19:35:29 -0400 Subject: [PATCH] QOL improvements --- src/class/AccountUtil.ts | 17 +++++++++++------ src/class/Util.ts | 5 ++++- src/commands/deleteaccount.ts | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/class/AccountUtil.ts b/src/class/AccountUtil.ts index 458a847..cb4d7c2 100644 --- a/src/class/AccountUtil.ts +++ b/src/class/AccountUtil.ts @@ -1,3 +1,4 @@ +import axios from 'axios'; import moment from 'moment'; import { randomBytes } from 'crypto'; import { AccountInterface } from '../models'; @@ -28,20 +29,23 @@ export default class AccountUtil { const accountInterface = await this.client.util.createAccount(passHash, etcPasswd, data.username, data.userID, data.emailAddress, moderator, code); await this.client.util.createModerationLog(data.userID, moderatorMember, 0); + const req = await axios.get('https://loc.sh/int/directory'); + const find = req.data.find((mem) => mem.userID === moderator); this.client.util.transport.sendMail({ to: data.emailAddress, from: 'Library of Code sp-us | Cloud Services ', replyTo: 'cloud-help@libraryofcode.org', - subject: 'Your account has been created!', + subject: 'Approval for CS Account', html: `

Library of Code | Cloud Services

-

Your Cloud Account has been created, welcome! Please see below for some details regarding your account and our services

+

Congratulations, your CS Account application has been approved. Welcome! Please see below for some details regarding your account and our services

Username: ${data.username}

Support Key: ${code} || You may be asked for this support key when contacting Library of Code, please keep the code in a safe area.

SSH Login:

ssh ${data.username}@cloud.libraryofcode.org
+

Underwritten by: ${moderatorMember.user.username}, ${find.pn.join(', ')}

Useful information

How to log in:

    @@ -53,14 +57,15 @@ export default class AccountUtil {

    Channels and Links

      -
    • #status - You can find the status of all our services, including the cloud machine, here
    • +
    • Status Page - You can find the status of all our services, including the cloud machine, here.
    • +
    • Wiki - Wiki site, includes information about the Cloud Server.
    • #cloud-announcements - Announcements regarding the cloud machine will be here. These include planned maintenance, updates to preinstalled services etc.
    • -
    • #cloud-info - Important information you will need to, or should, know to a certain extent. These include our infractions system and Tier limits
    • -
    • #cloud-support - A support channel specifically for the cloud machine, you can use this to ask how to renew your certificates, for example
    • +
    • #cloud-info - Important information you will need to, or should, know to a certain extent.
    • +
    • #cloud-support - A support channel specifically for the cloud machine.
    • Library of Code Support Desk - Our Support desk, you can contact Staff here.

    Want to support us?

    -

    You can support us on Patreon! Head to our Patreon page and feel free to donate as much or as little as you want!
    Donating $5 or more will grant you Tier 3, which means we will manage your account at your request, longer certificates, increased Tier limits as well as some roles in the server!

    +

    You can support us by purchasing a Tier 3 subscription! this site for more information.

    Library of Code sp-us | Support Team `, diff --git a/src/class/Util.ts b/src/class/Util.ts index 05b550c..72306ac 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -1,5 +1,6 @@ /* eslint-disable no-await-in-loop */ /* eslint-disable no-param-reassign */ +import axios from 'axios'; import { randomBytes } from 'crypto'; import childProcess from 'child_process'; import nodemailer from 'nodemailer'; @@ -286,11 +287,13 @@ export default class Util { case 3: archType = 'Technician'; embedTitle = 'Account Reclaim | Unlock'; color = '0099ff'; break; case 4: archType = 'Director'; embedTitle = 'Cloud Account | Delete'; color = 'ff0000'; break; } + const req = await axios.get('https://loc.sh/int/directory'); + const find = req.data.find((mem) => mem.userID === moderator.id); const embed = new RichEmbed() .setTitle(embedTitle) .setColor(color) .addField('User', `${username} | <@${userID}>`, true) - .addField(archType, moderatorID === this.client.user.id ? 'SYSTEM' : `<@${moderatorID}>`, true) + .addField(archType, moderatorID === this.client.user.id ? 'SYSTEM' : `$${moderator.username}, ${find.pn.join(', ')} (<@${moderatorID}>)`, true) .setFooter(this.client.user.username, this.client.user.avatarURL) .setTimestamp(); if (reason) embed.addField('Reason', reason || 'Not specified'); diff --git a/src/commands/deleteaccount.ts b/src/commands/deleteaccount.ts index 1c0abb6..05f8046 100644 --- a/src/commands/deleteaccount.ts +++ b/src/commands/deleteaccount.ts @@ -40,7 +40,7 @@ export default class DeleteAccount extends Command { if (reason) logInput.reason = reason; await this.client.util.createModerationLog(args[0], message.member, 4, reason); await this.client.util.deleteAccount(username); - await message.delete().catch(() => {}); + message.delete().catch(() => {}); this.client.util.transport.sendMail({ to: account.emailAddress,