forked from Galactic/galactic-bot
stringify script for manager eval
This commit is contained in:
parent
d10ec5020a
commit
187727fd90
@ -1,4 +1,4 @@
|
|||||||
const { Client, Collection } = require('discord.js');
|
const { Client, Collection, Options } = require('discord.js');
|
||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
const { inspect } = require('util');
|
const { inspect } = require('util');
|
||||||
|
|
||||||
@ -129,8 +129,9 @@ class DiscordClient extends Client {
|
|||||||
if (message._evalResult) this.evalResult(message);
|
if (message._evalResult) this.evalResult(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
async managerEval(script) {
|
async managerEval(script, options = {}) {
|
||||||
|
|
||||||
|
if(typeof script === 'function') script = `(${script})(this, ${JSON.stringify(options.context)})`;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
this._evals.set(script, { resolve, reject });
|
this._evals.set(script, { resolve, reject });
|
||||||
|
Loading…
Reference in New Issue
Block a user