Skip to content

Commit

Permalink
axios for verified scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragon1320 committed Oct 10, 2018
1 parent d34ff77 commit 5c13d6f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
const fs = require("fs");
const path = require("path");

const axios = require("axios");

// Override discord.js getAuth so our token doesn't get leaked in external scripts.
// Note: This must be patched before loading the rest of discord.js!
const config = require("../../config.json");
Expand Down Expand Up @@ -533,19 +535,22 @@ client.on("message", message => {

if (script.type === "js") {

// temp security testing
const handler = {};
const utils = {

RichEmbed: discord.RichEmbed
};

handler.sendMessage(content, options) = function(content, options) {
// verified only
if (script.verified === true) {

message.channel.send(content, options);
utils.axios = axios;
}

try {

botSandbox.exec(script.code, {
message: message,
RichEmbed: discord.RichEmbed
message,
utils
});
} catch (error) {

Expand Down

0 comments on commit 5c13d6f

Please sign in to comment.