From 923e7a6845f4c5db51bac7f61d0e0ee8328a9540 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 15 Jul 2023 03:53:25 +0200 Subject: [PATCH] fix: Show user nickname in interaction reply if set instead of username --- commands/filters.js | 4 ++-- commands/leave.js | 10 ++++++++-- commands/nowplaying.js | 2 +- commands/pause.js | 14 ++++++++++---- commands/play.js | 6 +++--- commands/remove.js | 2 +- commands/skip.js | 4 ++-- commands/volume.js | 4 ++-- 8 files changed, 29 insertions(+), 17 deletions(-) diff --git a/commands/filters.js b/commands/filters.js index 0ffbc2e..a871694 100644 --- a/commands/filters.js +++ b/commands/filters.js @@ -129,7 +129,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( @@ -148,7 +148,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( diff --git a/commands/leave.js b/commands/leave.js index 8985577..38daa19 100644 --- a/commands/leave.js +++ b/commands/leave.js @@ -32,7 +32,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setDescription( - `**${embedIcons.warning} Oops!**\n_Hmm.._ It seems I am already not in a voice channel!` + `**${embedIcons.warning} Oops!**\n_Hmm.._ It seems I am not in a voice channel!` ) .setColor(embedColors.colorWarning) ] @@ -45,8 +45,14 @@ module.exports = { return await interaction.editReply({ embeds: [ new EmbedBuilder() + .setAuthor({ + name: + interaction.member.nickname || + interaction.user.username, + iconURL: interaction.user.avatarURL() + }) .setDescription( - `**${embedIcons.success} Leaving channel**\nCleared the track queue and left voice channel. To play more music, use the \`/play\` command!` + `**${embedIcons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the \`/play\` command!` ) .setColor(embedColors.colorSuccess) ] diff --git a/commands/nowplaying.js b/commands/nowplaying.js index fbbc4ff..9214694 100644 --- a/commands/nowplaying.js +++ b/commands/nowplaying.js @@ -195,7 +195,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( diff --git a/commands/pause.js b/commands/pause.js index 39cb8bc..76e17f6 100644 --- a/commands/pause.js +++ b/commands/pause.js @@ -47,6 +47,12 @@ module.exports = { }); } + let durationFormat = + queue.currentTrack.raw.duration === 0 || + queue.currentTrack.duration === '0:00' + ? '' + : `\`${queue.currentTrack.duration}\``; + // change paused state to opposite of current state queue.node.setPaused(!queue.node.isPaused()); @@ -55,11 +61,11 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( - `**${embedIcons.pauseResumed} Paused track**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.` + `**${embedIcons.pauseResumed} Paused track**\n**${durationFormat} [${queue.currentTrack.title}](${queue.currentTrack.url})**` ) .setThumbnail(queue.currentTrack.thumbnail) .setColor(embedColors.colorSuccess) @@ -70,11 +76,11 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( - `**${embedIcons.pauseResumed} Resumed track**\n**[${queue.currentTrack.title}](${queue.currentTrack.url})**.` + `**${embedIcons.pauseResumed} Resumed track**\n**${durationFormat} [${queue.currentTrack.title}](${queue.currentTrack.url})**` ) .setThumbnail(queue.currentTrack.thumbnail) .setColor(embedColors.colorSuccess) diff --git a/commands/play.js b/commands/play.js index 6e02ab4..c585786 100644 --- a/commands/play.js +++ b/commands/play.js @@ -168,7 +168,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( @@ -191,7 +191,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( @@ -207,7 +207,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( diff --git a/commands/remove.js b/commands/remove.js index 8303e34..0f9a715 100644 --- a/commands/remove.js +++ b/commands/remove.js @@ -67,7 +67,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( diff --git a/commands/skip.js b/commands/skip.js index 30d5fae..2de89f1 100644 --- a/commands/skip.js +++ b/commands/skip.js @@ -67,7 +67,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( @@ -103,7 +103,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( diff --git a/commands/volume.js b/commands/volume.js index dfea041..ed92d66 100644 --- a/commands/volume.js +++ b/commands/volume.js @@ -72,7 +72,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription( @@ -87,7 +87,7 @@ module.exports = { embeds: [ new EmbedBuilder() .setAuthor({ - name: interaction.user.username, + name: interaction.member.nickname || interaction.user.username, iconURL: interaction.user.avatarURL() }) .setDescription(