send msgs to terminals on certain actions

merge-requests/4/head
Matthew 2020-05-22 22:19:38 -04:00
parent e1a7155cf5
commit 9092dfcae9
No known key found for this signature in database
GPG Key ID: D499B75C1390E321
5 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,7 @@ export default class Lock extends Command {
if (account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already locked.***`); if (account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already locked.***`);
const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`); const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`);
if (account.username === 'matthew' || account.root) return edit.edit(`***${this.client.stores.emojis.error} Permission denied.***`); if (account.username === 'matthew' || account.root) return edit.edit(`***${this.client.stores.emojis.error} Permission denied.***`);
await this.client.util.sendMessageToUserTerminal(account.username, 'ACCOUNT LOCKED BY TECHNICIAN | PREPARING TO LOGOUT').catch(() => { });
await this.client.util.exec(`lock ${account.username}`); await this.client.util.exec(`lock ${account.username}`);
await account.updateOne({ locked: true }); await account.updateOne({ locked: true });

View File

@ -42,6 +42,7 @@ export default class Notify extends Command {
`, `,
}); });
message.delete(); message.delete();
await this.client.util.sendMessageToUserTerminal(account.username, `NOTIFICATION FROM TECHNICIAN: ${args.slice(1).join(' ')}`).catch(() => { });
return edit.edit(`***${this.client.stores.emojis.success} Send notification to ${account.username}.***`); return edit.edit(`***${this.client.stores.emojis.success} Send notification to ${account.username}.***`);
} catch (error) { } catch (error) {
return this.client.util.handleError(error, message, this); return this.client.util.handleError(error, message, this);

View File

@ -37,6 +37,7 @@ export default class Tier extends Command {
embed.addField('Old Tier -> New Tier', `${account.tier} -> ${args[1]}`, true); embed.addField('Old Tier -> New Tier', `${account.tier} -> ${args[1]}`, true);
embed.setFooter(this.client.user.username, this.client.user.avatarURL); embed.setFooter(this.client.user.username, this.client.user.avatarURL);
embed.setTimestamp(); embed.setTimestamp();
await this.client.util.sendMessageToUserTerminal(account.username, `A technician has upgraded your tier to ${args[1]}`).catch(() => { });
this.client.createMessage('580950455581147146', { embed }); return this.client.getDMChannel(account.userID).then((channel) => channel.createMessage({ embed })).catch(); this.client.createMessage('580950455581147146', { embed }); return this.client.getDMChannel(account.userID).then((channel) => channel.createMessage({ embed })).catch();
} catch (error) { } catch (error) {
return this.client.util.handleError(error, message, this); return this.client.util.handleError(error, message, this);

View File

@ -22,6 +22,7 @@ export default class Warn extends Command {
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 Technician ${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}.***`);
await this.client.util.sendMessageToUserTerminal(account.username, `WARNING FROM TECHNICIAN: ${args.slice(1).join(' ')}`).catch(() => { });
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>',

View File

@ -31,6 +31,7 @@ export default function memory(client: Client) {
*/ */
if ((memoryConversion >= userLimits.hard) && set.has(acc.username)) { if ((memoryConversion >= userLimits.hard) && set.has(acc.username)) {
client.signale.info(`RAM Hard Limit Reached | ${acc.username} | ${memoryConversion}/${userLimits.hard} MB`); client.signale.info(`RAM Hard Limit Reached | ${acc.username} | ${memoryConversion}/${userLimits.hard} MB`);
await client.util.sendMessageToUserTerminal(acc.username, 'REACHED RAM LIMIT; SENDING KILL SIGNAL');
client.util.exec(`killall -9 -u ${acc.username}`); client.util.exec(`killall -9 -u ${acc.username}`);
const embed = new RichEmbed(); const embed = new RichEmbed();
embed.setTitle('Resource Enforcement Notification'); embed.setTitle('Resource Enforcement Notification');
@ -83,6 +84,7 @@ export default function memory(client: Client) {
client.getDMChannel(acc.userID).then((channel) => { client.getDMChannel(acc.userID).then((channel) => {
channel.createMessage({ embed: notifyEmbed }); channel.createMessage({ embed: notifyEmbed });
}); });
await client.util.sendMessageToUserTerminal(acc.username, `You are about to reach your RAM resource limits, you are currently using '${String(Math.round(memoryConversion))} MB' and your limit is '${String(userLimits.hard)} MB'. Please correct your usage to avoid further action.`).catch(() => { });
client.util.transport.sendMail({ client.util.transport.sendMail({
to: acc.emailAddress, to: acc.emailAddress,
from: 'Library of Code sp-us | Cloud Services <help@libraryofcode.org>', from: 'Library of Code sp-us | Cloud Services <help@libraryofcode.org>',