1
0
Fork 0

Merge branch 'master' of gitlab.libraryofcode.org:engineering/cloudservices

refactor/models
Matthew 2019-11-18 20:52:20 -05:00
commit 1e8512e9f5
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
7 changed files with 32 additions and 3 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ htmlEmail_templates
yarn-error.log
src/keys.json
dist
securesign_genrsa.ts

View File

@ -28,6 +28,8 @@ export default class Client extends Eris.Client {
public server: Server;
public updating: Boolean;
constructor() {
super(config.token, { getAllUsers: true, restMode: true, defaultImageFormat: 'png' });
@ -44,6 +46,7 @@ export default class Client extends Eris.Client {
displayTimestamp: true,
displayFilename: true,
});
this.updating = false;
this.events();
this.loadFunctions();
this.init();

View File

@ -56,7 +56,7 @@ export default class Security {
if (saltCheck.salt !== account.salt) return null;
return account;
} catch (error) {
this.client.signale.debug(error);
this.client.util.handleError(error);
return null;
}
}

View File

@ -46,7 +46,7 @@ export default class Server {
this.app.use(route.conf.path, route.router);
this.client.signale.success(`Successfully loaded route ${route.conf.path}`);
} catch (error) {
this.client.signale.error(error);
this.client.util.handleError(error);
}
});
}

View File

@ -16,6 +16,7 @@ export default class Bearer extends Command {
public async run(message: Message) {
try {
const account = await this.client.db.Account.findOne({ userID: message.author.id });
if (!account) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Account not found***`);
// eslint-disable-next-line no-underscore-dangle
const bearer = await this.client.server.security.createBearer(account._id);
const dm = await this.client.getDMChannel(message.author.id);

View File

@ -14,6 +14,7 @@ export { default as Parse } from './parse';
export { default as Parseall } from './parseall';
export { default as Ping } from './ping';
export { default as Pull } from './pull';
export { default as Restart } from './restart';
export { default as SecureSign } from './securesign';
export { default as Sysinfo } from './sysinfo';
export { default as Unlock } from './unlock';

23
src/commands/restart.ts Normal file
View File

@ -0,0 +1,23 @@
import { Message } from 'eris';
import { Client } from '..';
import { Command } from '../class';
export default class Restart extends Command {
constructor(client: Client) {
super(client);
this.name = 'restart';
this.description = 'Restart the bot';
this.permissions = { users: ['253600545972027394', '278620217221971968'] };
this.enabled = true;
}
public async run(message: Message, args: string[]) {
try {
if (this.client.updating && args[0] !== '-f') return message.channel.createMessage(`${this.client.stores.emojis.error} ***Update in progress***`);
await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Restarting...***`);
return process.exit(1);
} catch (error) {
return this.client.util.handleError(error, message, this);
}
}
}