veeeee 😭
This commit is contained in:
commit
fe0df783a3
3 changed files with 262 additions and 0 deletions
107
index.js
Normal file
107
index.js
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
const {
|
||||||
|
Client,
|
||||||
|
ApplicationCommandOptionTypes,
|
||||||
|
ApplicationCommandTypes,
|
||||||
|
InteractionTypes,
|
||||||
|
MessageFlags
|
||||||
|
} = 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([
|
||||||
|
{
|
||||||
|
name: "say",
|
||||||
|
description: "Says whatever you provide",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: "content",
|
||||||
|
description: "...",
|
||||||
|
type: ApplicationCommandOptionTypes.STRING,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "raw",
|
||||||
|
description: "...",
|
||||||
|
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "eval",
|
||||||
|
description: "...",
|
||||||
|
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on("interactionCreate", async (interaction) => {
|
||||||
|
if (InteractionTypes.APPLICATION_COMMAND === interaction.type) {
|
||||||
|
await interaction.defer();
|
||||||
|
await interaction.deleteOriginal();
|
||||||
|
if (interaction.data.type === ApplicationCommandTypes.CHAT_INPUT) {
|
||||||
|
const content = interaction.data.options.getString("content", true);
|
||||||
|
const raw = interaction.data.options.getBoolean("raw");
|
||||||
|
const shouldEval = interaction.data.options.getBoolean("eval");
|
||||||
|
|
||||||
|
interaction.createFollowup(
|
||||||
|
shouldEval
|
||||||
|
? {
|
||||||
|
content: await evaluate(content, interaction)
|
||||||
|
}
|
||||||
|
: raw
|
||||||
|
? JSON.parse(content)
|
||||||
|
: {
|
||||||
|
content
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
client.connect();
|
20
package.json
Normal file
20
package.json
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "vibe-coded-say",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"packageManager": "pnpm@10.7.1",
|
||||||
|
"dependencies": {
|
||||||
|
"oceanic.js": "^1.11.2",
|
||||||
|
"prettier": "^3.5.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^22.14.0"
|
||||||
|
}
|
||||||
|
}
|
135
pnpm-lock.yaml
generated
Normal file
135
pnpm-lock.yaml
generated
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
lockfileVersion: '9.0'
|
||||||
|
|
||||||
|
settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
dependencies:
|
||||||
|
oceanic.js:
|
||||||
|
specifier: ^1.11.2
|
||||||
|
version: 1.11.2
|
||||||
|
prettier:
|
||||||
|
specifier: ^3.5.3
|
||||||
|
version: 3.5.3
|
||||||
|
devDependencies:
|
||||||
|
'@types/node':
|
||||||
|
specifier: ^22.14.0
|
||||||
|
version: 22.14.0
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
'@discordjs/voice@0.17.0':
|
||||||
|
resolution: {integrity: sha512-hArn9FF5ZYi1IkxdJEVnJi+OxlwLV0NJYWpKXsmNOojtGtAZHxmsELA+MZlu2KW1F/K1/nt7lFOfcMXNYweq9w==}
|
||||||
|
engines: {node: '>=16.11.0'}
|
||||||
|
deprecated: This version uses deprecated encryption modes. Please use a newer version.
|
||||||
|
|
||||||
|
'@types/node@22.14.0':
|
||||||
|
resolution: {integrity: sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA==}
|
||||||
|
|
||||||
|
'@types/ws@8.18.1':
|
||||||
|
resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==}
|
||||||
|
|
||||||
|
discord-api-types@0.37.83:
|
||||||
|
resolution: {integrity: sha512-urGGYeWtWNYMKnYlZnOnDHm8fVRffQs3U0SpE8RHeiuLKb/u92APS8HoQnPTFbnXmY1vVnXjXO4dOxcAn3J+DA==}
|
||||||
|
|
||||||
|
oceanic.js@1.11.2:
|
||||||
|
resolution: {integrity: sha512-kXMoZiIrIFq0QCfsZGJ+eOK+1IFkVsTpvwcQ3nfY6ioDKGVdHQjVIXNJAYvJb5c5la//2OU8WGpqsmp/bAP8aw==}
|
||||||
|
engines: {node: '>=18.13.0'}
|
||||||
|
|
||||||
|
prettier@3.5.3:
|
||||||
|
resolution: {integrity: sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==}
|
||||||
|
engines: {node: '>=14'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
prism-media@1.3.5:
|
||||||
|
resolution: {integrity: sha512-IQdl0Q01m4LrkN1EGIE9lphov5Hy7WWlH6ulf5QdGePLlPas9p2mhgddTEHrlaXYjjFToM1/rWuwF37VF4taaA==}
|
||||||
|
peerDependencies:
|
||||||
|
'@discordjs/opus': '>=0.8.0 <1.0.0'
|
||||||
|
ffmpeg-static: ^5.0.2 || ^4.2.7 || ^3.0.0 || ^2.4.0
|
||||||
|
node-opus: ^0.3.3
|
||||||
|
opusscript: ^0.0.8
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@discordjs/opus':
|
||||||
|
optional: true
|
||||||
|
ffmpeg-static:
|
||||||
|
optional: true
|
||||||
|
node-opus:
|
||||||
|
optional: true
|
||||||
|
opusscript:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
tslib@2.8.1:
|
||||||
|
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||||
|
|
||||||
|
undici-types@6.21.0:
|
||||||
|
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||||
|
|
||||||
|
ws@8.18.1:
|
||||||
|
resolution: {integrity: sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==}
|
||||||
|
engines: {node: '>=10.0.0'}
|
||||||
|
peerDependencies:
|
||||||
|
bufferutil: ^4.0.1
|
||||||
|
utf-8-validate: '>=5.0.2'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
bufferutil:
|
||||||
|
optional: true
|
||||||
|
utf-8-validate:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
snapshots:
|
||||||
|
|
||||||
|
'@discordjs/voice@0.17.0':
|
||||||
|
dependencies:
|
||||||
|
'@types/ws': 8.18.1
|
||||||
|
discord-api-types: 0.37.83
|
||||||
|
prism-media: 1.3.5
|
||||||
|
tslib: 2.8.1
|
||||||
|
ws: 8.18.1
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@discordjs/opus'
|
||||||
|
- bufferutil
|
||||||
|
- ffmpeg-static
|
||||||
|
- node-opus
|
||||||
|
- opusscript
|
||||||
|
- utf-8-validate
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@types/node@22.14.0':
|
||||||
|
dependencies:
|
||||||
|
undici-types: 6.21.0
|
||||||
|
|
||||||
|
'@types/ws@8.18.1':
|
||||||
|
dependencies:
|
||||||
|
'@types/node': 22.14.0
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
discord-api-types@0.37.83:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
oceanic.js@1.11.2:
|
||||||
|
dependencies:
|
||||||
|
tslib: 2.8.1
|
||||||
|
ws: 8.18.1
|
||||||
|
optionalDependencies:
|
||||||
|
'@discordjs/voice': 0.17.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@discordjs/opus'
|
||||||
|
- bufferutil
|
||||||
|
- ffmpeg-static
|
||||||
|
- node-opus
|
||||||
|
- opusscript
|
||||||
|
- utf-8-validate
|
||||||
|
|
||||||
|
prettier@3.5.3: {}
|
||||||
|
|
||||||
|
prism-media@1.3.5:
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
tslib@2.8.1: {}
|
||||||
|
|
||||||
|
undici-types@6.21.0: {}
|
||||||
|
|
||||||
|
ws@8.18.1: {}
|
Loading…
Add table
Add a link
Reference in a new issue