add fileoutput to eval

This commit is contained in:
bignutty 2025-01-30 11:28:44 +01:00
parent 3fb5a69561
commit 19edeaaff2

View file

@ -1,5 +1,6 @@
const { acknowledge } = require("#utils/interactions");
const { codeblock } = require("#utils/markdown");
const { editOrReply } = require("#utils/message");
const { Utils } = require("detritus-client");
const { DiscordRegexNames } = require("detritus-client/lib/constants");
@ -19,6 +20,7 @@ module.exports = {
},
args: [
{ default: false, name: "noreply", type: "bool", help: "Reply with evaluated output" },
{ default: false, name: "fileout", type: "bool", help: "Respond with output as a file" },
{ default: 2, name: "jsonspacing", type: "number", help: "Spacing for formatted json" },
{ default: true, name: "async", type: "bool", help: "Async evaluation" }
],
@ -54,6 +56,16 @@ module.exports = {
const max = 1990 - language.length;
if (!args.noreply) {
const reply = codeblock(language, [String(message).slice(0, max)])
if(args.fileout){
return editOrReply(context, {
files: [
{
filename: "out.txt",
value: Buffer.from(message)
}
]
})
}
return context.editOrReply(
reply
);