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

235
Views
How to change this message to an code block message?

I want to change this part into a code block message

message.channel.send(`${client.player.getQueue(message).loopMode ? '(looped)' : ''}\nCurrent: **__${queue.playing.author} | ${queue.playing.title}__** \n\n` + (queue.tracks.map((track, i) => {
            return `**${i + 1})** ${track.author} - ${track.title} | ${track.requestedBy.username}`
        }).slice(0, 10).join('\n') + `\n\n${queue.tracks.length > 10 ? `And **${queue.tracks.length - 10}** more track(s)` : `   **This is the end of the queue!**`}`));

I tried but it's not working

Here's the full code

module.exports = {
    name: 'queue',
    aliases: ['q'],
    category: 'Music',
    utilisation: '{prefix}queue',

    execute(client, message) {

        const queue = client.player.getQueue(message);

        message.channel.send(`${client.player.getQueue(message).loopMode ? '(looped)' : ''}\nCurrent: **__${queue.playing.author} | ${queue.playing.title}__** \n\n` + (queue.tracks.map((track, i) => {
            return `**${i + 1})** ${track.author} - ${track.title} | ${track.requestedBy.username}`
        }).slice(0, 10).join('\n') + `\n\n${queue.tracks.length > 10 ? `And **${queue.tracks.length - 10}** more track(s)` : `   **This is the end of the queue!**`}`));
    },
};
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Since codeblocks have to be made with tripple `, you can just add them to the beginning and end like you normally do but escape them with a backslash so your normal string template doesnt end early:

message.channel.send(`\`\`\`${client.player.getQueue(message).loopMode ? '(looped)' : ''}\nCurrent: **__${queue.playing.author} | ${queue.playing.title}__** \n\n` + (queue.tracks.map((track, i) => {
            return `**${i + 1})** ${track.author} - ${track.title} | ${track.requestedBy.username}`
        }).slice(0, 10).join('\n') + `\n\n${queue.tracks.length > 10 ? `And **${queue.tracks.length - 10}** more track(s)` : `   **This is the end of the queue!**`}\`\`\``));
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!