I want to change this part into a code block message
JavaScript
x
4
1
message.channel.send(`${client.player.getQueue(message).loopMode ? '(looped)' : ''}nCurrent: **__${queue.playing.author} | ${queue.playing.title}__** nn` + (queue.tracks.map((track, i) => {
2
return `**${i + 1})** ${track.author} - ${track.title} | ${track.requestedBy.username}`
3
}).slice(0, 10).join('n') + `nn${queue.tracks.length > 10 ? `And **${queue.tracks.length - 10}** more track(s)` : ` **This is the end of the queue!**`}`));
4
I tried but it’s not working
Here’s the full code
JavaScript
1
16
16
1
module.exports = {
2
name: 'queue',
3
aliases: ['q'],
4
category: 'Music',
5
utilisation: '{prefix}queue',
6
7
execute(client, message) {
8
9
const queue = client.player.getQueue(message);
10
11
message.channel.send(`${client.player.getQueue(message).loopMode ? '(looped)' : ''}nCurrent: **__${queue.playing.author} | ${queue.playing.title}__** nn` + (queue.tracks.map((track, i) => {
12
return `**${i + 1})** ${track.author} - ${track.title} | ${track.requestedBy.username}`
13
}).slice(0, 10).join('n') + `nn${queue.tracks.length > 10 ? `And **${queue.tracks.length - 10}** more track(s)` : ` **This is the end of the queue!**`}`));
14
},
15
};
16
Advertisement
Answer
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:
JavaScript
1
4
1
message.channel.send(````${client.player.getQueue(message).loopMode ? '(looped)' : ''}nCurrent: **__${queue.playing.author} | ${queue.playing.title}__** nn` + (queue.tracks.map((track, i) => {
2
return `**${i + 1})** ${track.author} - ${track.title} | ${track.requestedBy.username}`
3
}).slice(0, 10).join('n') + `nn${queue.tracks.length > 10 ? `And **${queue.tracks.length - 10}** more track(s)` : ` **This is the end of the queue!**`}````));
4