1
0
Fork 0

get config from client, also remove weird evalMessage thing

refactor/models
Matthew 2019-10-27 21:23:56 -04:00
parent 9e5c9da6e2
commit 6312fa243e
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@
import { Message } from 'eris'; import { Message } from 'eris';
import { inspect } from 'util'; import { inspect } from 'util';
import axios from 'axios'; import axios from 'axios';
import { Client, config } from '..'; import { Client } from '..';
import { Command } from '../class'; import { Command } from '../class';
export default class Eval extends Command { export default class Eval extends Command {
@ -17,21 +17,21 @@ export default class Eval extends Command {
public async run(message: Message) { public async run(message: Message) {
try { try {
const evalMessage = message.content.slice(config.prefix.length).split(' ').slice(1).join(' '); // const evalMessage = message.content.slice(this.client.config.prefix.length).split(' ').slice(1).join(' ');
let evaled: any; let evaled: any;
let output: string; let output: string;
try { try {
evaled = await eval(evalMessage); evaled = await eval(message.content);
if (typeof evaled !== 'string') output = output && inspect(evaled, { depth: 1 }); if (typeof evaled !== 'string') output = output && inspect(evaled, { depth: 1 });
} catch (error) { } catch (error) {
output = error.stack; output = error.stack;
} }
if (output) { if (output) {
output = output.replace(RegExp(config.prefix, 'gi'), 'juul'); output = output.replace(RegExp(this.client.config.prefix, 'gi'), 'juul');
output = output.replace(RegExp(config.emailPass, 'gi'), 'juul'); output = output.replace(RegExp(this.client.config.emailPass, 'gi'), 'juul');
output = output.replace(RegExp(config.cloudflare, 'gi'), 'juul'); output = output.replace(RegExp(this.client.config.cloudflare, 'gi'), 'juul');
} }
const display = this.client.util.splitString(output, 1975); const display = this.client.util.splitString(output, 1975);