mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 06:03:04 -04:00
add fileoutput to eval
This commit is contained in:
parent
3fb5a69561
commit
19edeaaff2
1 changed files with 12 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
const { acknowledge } = require("#utils/interactions");
|
const { acknowledge } = require("#utils/interactions");
|
||||||
const { codeblock } = require("#utils/markdown");
|
const { codeblock } = require("#utils/markdown");
|
||||||
|
const { editOrReply } = require("#utils/message");
|
||||||
|
|
||||||
const { Utils } = require("detritus-client");
|
const { Utils } = require("detritus-client");
|
||||||
const { DiscordRegexNames } = require("detritus-client/lib/constants");
|
const { DiscordRegexNames } = require("detritus-client/lib/constants");
|
||||||
|
@ -19,6 +20,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
args: [
|
args: [
|
||||||
{ default: false, name: "noreply", type: "bool", help: "Reply with evaluated output" },
|
{ 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: 2, name: "jsonspacing", type: "number", help: "Spacing for formatted json" },
|
||||||
{ default: true, name: "async", type: "bool", help: "Async evaluation" }
|
{ default: true, name: "async", type: "bool", help: "Async evaluation" }
|
||||||
],
|
],
|
||||||
|
@ -54,6 +56,16 @@ module.exports = {
|
||||||
const max = 1990 - language.length;
|
const max = 1990 - language.length;
|
||||||
if (!args.noreply) {
|
if (!args.noreply) {
|
||||||
const reply = codeblock(language, [String(message).slice(0, max)])
|
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(
|
return context.editOrReply(
|
||||||
reply
|
reply
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue