Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
How can we add js using discord.js using typescript

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
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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"});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!