actually remove eval

This commit is contained in:
nin0 2025-04-30 19:40:00 -04:00
parent 1fad249b81
commit c95bec8427
Signed by: nin0
SSH key fingerprint: SHA256:NOoDnFVvZNFvqfXCIhzr6oCTDImZAbTTuyAysZ8Ufk8

View file

@ -2,54 +2,13 @@ const {
Client,
ApplicationCommandOptionTypes,
ApplicationCommandTypes,
InteractionTypes,
MessageFlags
InteractionTypes
} = require("oceanic.js");
const client = new Client({
auth: `Bot ${process.env.BOT_TOKEN}`
});
async function evaluate(shitcode, intera) {
const console = {
_lines: [],
_log(...things) {
this._lines.push(
...things
.map((x) => inspect(x, { getters: true }))
.join(" ")
.split("\n")
);
}
};
console.log =
console.error =
console.warn =
console.info =
console._log.bind(console);
const int = intera;
const fs = require("fs");
const http = require("http");
const https = require("https");
const crypto = require("crypto");
const net = require("net");
const path = require("path");
const util = require("util");
const assert = require("assert");
const os = require("os");
const oceanic = require("oceanic.js");
let script = shitcode.replace(/(^`{3}(js|javascript)?|`{3}$)/g, "");
if (script.includes("await")) script = `(async () => { ${script} })()`;
try {
return await eval(script);
} catch (e) {
return e;
}
}
client.on("ready", () => {
console.log(`Logged in as ${client.user.username}`);
client.application.bulkEditGlobalCommands([
@ -79,7 +38,7 @@ client.on("interactionCreate", async (interaction) => {
await interaction.defer();
await interaction.deleteOriginal();
if(interaction.user.id !== "886685857560539176") {
if (interaction.user.id !== "886685857560539176") {
return interaction.createFollowup({
content: "@everyone"
});
@ -89,11 +48,12 @@ client.on("interactionCreate", async (interaction) => {
const content = interaction.data.options.getString("content", true);
const raw = interaction.data.options.getBoolean("raw");
interaction.createFollowup(raw
? JSON.parse(content)
: {
content
}
interaction.createFollowup(
raw
? JSON.parse(content)
: {
content
}
);
}
}