forked from engineering/cloudservices
Merge branch 'master' of gitlab.libraryofcode.org:engineering/cloudservices
commit
1e8512e9f5
|
@ -5,4 +5,5 @@ package-lock.json
|
|||
htmlEmail_templates
|
||||
yarn-error.log
|
||||
src/keys.json
|
||||
dist
|
||||
dist
|
||||
securesign_genrsa.ts
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue