In the
message.channel.send(output, {code: "js"});
code it always says
Expected 1 arguments, but got 2.
what the {code: "js"} do is that it adds `````` to the code how do i fix this?
keep in mind I am using WOKCommand handler.
import { ICommand } from "wokcommands";
import { Client, Message, MessageEmbed } from "discord.js";
import { inspect } from "util"
export default {
category: 'Moderation',
description: 'Deletes multiple messages at once.',
ownerOnly: true,
maxArgs: 1,
expectedArgs: '[amount]',
slash: false,
callback: async ({client, message, args}) => {
if (message.author.id !== '763857069413367878') return;
const code = args.join(" ");
if(!code) return `Please provide some code to evaluate`
try {
const result = await eval(code);
let output = result;
if(typeof result !== 'string') {
output = inspect(result)
}
message.channel.send(output, {code: "js"});
} catch (error) {
message.channel.send('Evaluated some code but to long!')
};
},
} as ICommand
In newer versions of discord.js you now need to pass everything in one object.
This can be done like this:
message.channel.send({content: output, code: "js"});