1
0
Fork 0

various changes

refactor/models
Matthew 2020-05-01 02:51:02 -04:00
parent 3731ecb863
commit 50a9d05f97
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
10 changed files with 21 additions and 18 deletions

View File

@ -55,7 +55,7 @@ export default class AccountUtil {
<li><a target="_blank" href="https://discordapp.com/channels/446067825673633794/620355063088414769">#cloud-announcements</a> - Announcements regarding the cloud machine will be here. These include planned maintenance, updates to preinstalled services etc.</li> <li><a target="_blank" href="https://discordapp.com/channels/446067825673633794/620355063088414769">#cloud-announcements</a> - Announcements regarding the cloud machine will be here. These include planned maintenance, updates to preinstalled services etc.</li>
<li><a target="_blank" href="https://discordapp.com/channels/446067825673633794/620349128295186472">#cloud-info</a> - Important information you will need to, or should, know to a certain extent. These include our infractions system and Tier limits</li> <li><a target="_blank" href="https://discordapp.com/channels/446067825673633794/620349128295186472">#cloud-info</a> - Important information you will need to, or should, know to a certain extent. These include our infractions system and Tier limits</li>
<li><a target="_blank" href="https://discordapp.com/channels/446067825673633794/546457788184789013">#cloud-support</a> - A support channel specifically for the cloud machine, you can use this to ask how to renew your certificates, for example</li> <li><a target="_blank" href="https://discordapp.com/channels/446067825673633794/546457788184789013">#cloud-support</a> - A support channel specifically for the cloud machine, you can use this to ask how to renew your certificates, for example</li>
<li><a target="_blank" href="https://support.libraryofcode.org">Library of Code Support Desk</a> - Our Support desk, you can contact Staff here.</li> <li><a target="_blank" href="https://staff.libraryofcode.org/servicedesk/customer/portal/1">Library of Code Support Desk</a> - Our Support desk, you can contact Staff here.</li>
</ul> </ul>
<h3>Want to support us?</h3> <h3>Want to support us?</h3>
<p>You can support us on Patreon! Head to <a target="_blank" href="https://www.patreon.com/libraryofcode">our Patreon page</a> and feel free to donate as much or as little as you want!<br>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!</p> <p>You can support us on Patreon! Head to <a target="_blank" href="https://www.patreon.com/libraryofcode">our Patreon page</a> and feel free to donate as much or as little as you want!<br>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!</p>

View File

@ -229,11 +229,11 @@ export default class Util {
let archType: string; let archType: string;
switch (type) { switch (type) {
default: archType = 'Staff'; embedTitle = 'Cloud Account | Generic'; color = '0892e1'; break; default: archType = 'Staff'; embedTitle = 'Cloud Account | Generic'; color = '0892e1'; break;
case 0: archType = 'Administrator'; embedTitle = 'Cloud Account | Create'; color = '00ff00'; break; case 0: archType = 'Technician'; embedTitle = 'Cloud Account | Create'; color = '00ff00'; break;
case 1: archType = 'Staff'; embedTitle = 'Account Warning | Warn'; color = 'ffff00'; break; case 1: archType = 'Technician'; embedTitle = 'Account Warning | Warn'; color = 'ffff00'; break;
case 2: archType = 'Moderator'; embedTitle = 'Account Infraction | Lock'; color = 'ff6600'; break; case 2: archType = 'Technician'; embedTitle = 'Account Infraction | Lock'; color = 'ff6600'; break;
case 3: archType = 'Moderator'; embedTitle = 'Account Reclaim | Unlock'; color = '0099ff'; break; case 3: archType = 'Technician'; embedTitle = 'Account Reclaim | Unlock'; color = '0099ff'; break;
case 4: archType = 'Administrator'; embedTitle = 'Cloud Account | Delete'; color = 'ff0000'; break; case 4: archType = 'Director'; embedTitle = 'Cloud Account | Delete'; color = 'ff0000'; break;
} }
const embed = new RichEmbed() const embed = new RichEmbed()
.setTitle(embedTitle) .setTitle(embedTitle)

View File

@ -37,6 +37,7 @@ export default class CreateAccount extends Command {
const confirmation = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Creating account...***`); const confirmation = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Creating account...***`);
const data = await this.client.util.accounts.createAccount({ userID: args[0], username: args[2], emailAddress: args[1] }, message.author.id); const data = await this.client.util.accounts.createAccount({ userID: args[0], username: args[2], emailAddress: args[1] }, message.author.id);
message.delete();
return confirmation.edit(`${this.client.stores.emojis.success} ***Account successfully created***\n**Username:** \`${args[2]}\`\n**Temporary Password:** \`${data.tempPass}\``); return confirmation.edit(`${this.client.stores.emojis.success} ***Account successfully created***\n**Username:** \`${args[2]}\`\n**Temporary Password:** \`${data.tempPass}\``);
} catch (error) { } catch (error) {

View File

@ -41,6 +41,7 @@ export default class DeleteAccount extends Command {
if (reason) logInput.reason = reason; if (reason) logInput.reason = reason;
await this.client.util.createModerationLog(args[0], message.member, 4, reason); await this.client.util.createModerationLog(args[0], message.member, 4, reason);
await this.client.util.deleteAccount(username); await this.client.util.deleteAccount(username);
message.delete();
this.client.util.transport.sendMail({ this.client.util.transport.sendMail({
to: account.emailAddress, to: account.emailAddress,
@ -48,15 +49,15 @@ export default class DeleteAccount extends Command {
subject: 'Your account has been deleted', subject: 'Your account has been deleted',
html: ` html: `
<h1>Library of Code | Cloud Services</h1> <h1>Library of Code | Cloud Services</h1>
<p>Your Cloud Account has been deleted by our Engineers. If your account was deleted due to infractions, this will not be appealable. We're sorry to see you go.</p> <p>Your Cloud Account has been deleted by a Director. If your account was deleted due to infractions, this will not be appealable. We're sorry to see you go.</p>
<p><b>Reason:</b> ${reason}</p> <p><b>Reason:</b> ${reason}</p>
<p><b>Engineer:</b> ${message.author.username}</p> <p><b>Director:</b> ${message.author.username}</p>
<b><i>Library of Code sp-us | Support Team</i></b> <b><i>Library of Code sp-us | Support Team</i></b>
`, `,
}); });
return deleting.edit(`${this.client.stores.emojis.success} ***Account ${username} has been deleted by Engineer ${message.author.username}#${message.author.discriminator}***`); return deleting.edit(`${this.client.stores.emojis.success} ***Account ${username} has been deleted by Director ${message.author.username}#${message.author.discriminator}***`);
} catch (error) { } catch (error) {
return this.client.util.handleError(error, message, this); return this.client.util.handleError(error, message, this);
} }

View File

@ -31,7 +31,7 @@ export default class Lock extends Command {
const reason = momentMilliseconds ? args.slice(2).join(' ') : args.slice(1).join(' '); const reason = momentMilliseconds ? args.slice(2).join(' ') : args.slice(1).join(' ');
await this.client.util.createModerationLog(account.userID, message.member, 2, reason, momentMilliseconds); await this.client.util.createModerationLog(account.userID, message.member, 2, reason, momentMilliseconds);
edit.edit(`***${this.client.stores.emojis.success} Account ${account.username} has been locked by Moderator ${message.author.username}#${message.author.discriminator}.***`); edit.edit(`***${this.client.stores.emojis.success} Account ${account.username} has been locked by Technician ${message.author.username}#${message.author.discriminator}.***`);
message.delete(); message.delete();
this.client.util.transport.sendMail({ this.client.util.transport.sendMail({
@ -42,7 +42,7 @@ export default class Lock extends Command {
<h1>Library of Code | Cloud Services</h1> <h1>Library of Code | Cloud Services</h1>
<p>Your Cloud Account has been locked until ${momentMilliseconds ? moment(expiry).calendar() : 'indefinitely'} under the EULA.</p> <p>Your Cloud Account has been locked until ${momentMilliseconds ? moment(expiry).calendar() : 'indefinitely'} under the EULA.</p>
<p><b>Reason:</b> ${momentMilliseconds ? args.slice(2).join(' ') : args.slice(1).join(' ')}</p> <p><b>Reason:</b> ${momentMilliseconds ? args.slice(2).join(' ') : args.slice(1).join(' ')}</p>
<p><b>Supervisor:</b> ${message.author.username}</p> <p><b>Technician:</b> ${message.author.username}</p>
<p><b>Expiration:</b> ${momentMilliseconds ? moment(expiry).format('dddd, MMMM Do YYYY, h:mm:ss A') : 'N/A'}</p> <p><b>Expiration:</b> ${momentMilliseconds ? moment(expiry).format('dddd, MMMM Do YYYY, h:mm:ss A') : 'N/A'}</p>
<b><i>Library of Code sp-us | Support Team</i></b> <b><i>Library of Code sp-us | Support Team</i></b>

View File

@ -36,7 +36,7 @@ export default class Notify extends Command {
html: ` html: `
<h1>Library of Code sp-us | Cloud Services</h1> <h1>Library of Code sp-us | Cloud Services</h1>
<p>${args.slice(1).join(' ')}</p> <p>${args.slice(1).join(' ')}</p>
<p><strong>Moderator:</strong> ${message.author.username}</p> <p><strong>Technician:</strong> ${message.author.username}</p>
<b><i>Library of Code sp-us | Support Team</i></b> <b><i>Library of Code sp-us | Support Team</i></b>
`, `,

View File

@ -26,8 +26,8 @@ export default class SysInfo extends Command {
embed.addField('CPU', `${os.cpus()[0].model} ${os.cpus()[0].speed / 1000}GHz | ${os.cpus().length} Cores | ${os.arch()}`, true); embed.addField('CPU', `${os.cpus()[0].model} ${os.cpus()[0].speed / 1000}GHz | ${os.cpus().length} Cores | ${os.arch()}`, true);
embed.addField('Load Average (last 15 minutes)', os.loadavg()[2].toFixed(3), true); embed.addField('Load Average (last 15 minutes)', os.loadavg()[2].toFixed(3), true);
embed.addField('Memory/RAM', `${usedMemory} / ${dataConversion(totalmem())}`, true); embed.addField('Memory/RAM', `${usedMemory} / ${dataConversion(totalmem())}`, true);
embed.addField('Network Interfaces (IPv4)', os.networkInterfaces().eth0.filter((r) => r.family === 'IPv4')[0].address, true); embed.addField('Network Interfaces (IPv4)', os.networkInterfaces().enp0s3.filter((r) => r.family === 'IPv4')[0].address, true);
embed.addField('Network Interfaces (IPv6)', os.networkInterfaces().eth0.filter((r) => r.family === 'IPv6')[0].address.replace(/:/gi, '\:'), true); // eslint-disable-line embed.addField('Network Interfaces (IPv6)', os.networkInterfaces().enp0s3.filter((r) => r.family === 'IPv6')[0].address.replace(/:/gi, '\:'), true); // eslint-disable-line
embed.setFooter(this.client.user.username, this.client.user.avatarURL); embed.setFooter(this.client.user.username, this.client.user.avatarURL);
embed.setTimestamp(); embed.setTimestamp();
message.channel.createMessage({ embed }); message.channel.createMessage({ embed });

View File

@ -11,7 +11,7 @@ export default class Unban extends Command {
this.aliases = ['unbanip']; this.aliases = ['unbanip'];
this.usage = `${this.client.config.prefix}unban [service] [ip]`; this.usage = `${this.client.config.prefix}unban [service] [ip]`;
this.permissions = { roles: ['662163685439045632', '701454780828221450'] }; this.permissions = { roles: ['662163685439045632', '701454780828221450'] };
this.enabled = true; this.enabled = false;
} }
public async run(message: Message, args: string[]) { public async run(message: Message, args: string[]) {

View File

@ -23,7 +23,8 @@ export default class Unlock extends Command {
await account.updateOne({ locked: false }); await account.updateOne({ locked: false });
await this.client.util.createModerationLog(account.userID, message.member, 3, args.slice(1).join(' ')); await this.client.util.createModerationLog(account.userID, message.member, 3, args.slice(1).join(' '));
edit.edit(`***${this.client.stores.emojis.success} Account ${account.username} has been unlocked by Moderator ${message.author.username}#${message.author.discriminator}.***`); message.delete();
edit.edit(`***${this.client.stores.emojis.success} Account ${account.username} has been unlocked by Technician ${message.author.username}#${message.author.discriminator}.***`);
} catch (error) { } catch (error) {
await this.client.util.handleError(error, message, this); await this.client.util.handleError(error, message, this);
} }

View File

@ -21,7 +21,7 @@ export default class Warn extends Command {
if (account.root) return edit.edit(`***${this.client.stores.emojis.error} Permission denied.***`); if (account.root) return edit.edit(`***${this.client.stores.emojis.error} Permission denied.***`);
await this.client.util.createModerationLog(account.userID, message.member, 1, args.slice(1).join(' ')); await this.client.util.createModerationLog(account.userID, message.member, 1, args.slice(1).join(' '));
message.delete(); message.delete();
edit.edit(`***${this.client.stores.emojis.success} Account ${account.username} has been warned by Moderator ${message.author.username}#${message.author.discriminator}.***`); edit.edit(`***${this.client.stores.emojis.success} Account ${account.username} has been warned by Technician ${message.author.username}#${message.author.discriminator}.***`);
return this.client.util.transport.sendMail({ return this.client.util.transport.sendMail({
to: account.emailAddress, to: account.emailAddress,
from: 'Library of Code sp-us | Cloud Services <help@libraryofcode.org>', from: 'Library of Code sp-us | Cloud Services <help@libraryofcode.org>',
@ -30,7 +30,7 @@ export default class Warn extends Command {
<h1>Library of Code sp-us | Cloud Services</h1> <h1>Library of Code sp-us | Cloud Services</h1>
<p>Your account has received an official warning from a Moderator. Please get the underlying issue resolved to avoid <i>possible</i> moderative action.</p> <p>Your account has received an official warning from a Moderator. Please get the underlying issue resolved to avoid <i>possible</i> moderative action.</p>
<p><strong>Reason:</strong> ${args.slice(1).join(' ') ? args.slice(1).join(' ') : 'Not Specified'}</p> <p><strong>Reason:</strong> ${args.slice(1).join(' ') ? args.slice(1).join(' ') : 'Not Specified'}</p>
<p><strong>Moderator:</strong> ${message.author.username}</p> <p><strong>Technician:</strong> ${message.author.username}</p>
<b><i>Library of Code sp-us | Support Team</i></b> <b><i>Library of Code sp-us | Support Team</i></b>
`, `,