Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Eval function
- function clean(text) {
- if (typeof(text) === "string")
- return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
- else {
- return text;
- }
- }
- function evalCode(args) {
- client.on("message", message => {
- const args = message.content.split(" ").slice(1);
- if (message.content.startsWith(prefix + "eval")) {
- if(message.author.id !== ownerID) return;
- try {
- const code = args.join(" ");
- let evaled = eval(code);
- if (typeof evaled !== "string")
- evaled = require("util").inspect(evaled);
- message.channel.send(clean(evaled), {code:"xl"})
- .then(message => console.log('Sent #' + message.id + ': ' + message.content))
- .catch(console.error);
- } catch (err) {
- message.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement