fix: Show user nickname in interaction reply if set instead of username

This commit is contained in:
Marius Begby committed 2023-07-15 03:53:25 +02:00
1 parent 391627d510
commit 923e7a6845
8 files changed
+29 -17

No files matched your search

+2 -2
View File
@@ -129,7 +129,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
@@ -148,7 +148,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
+8 -2
View File
@@ -32,7 +32,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setDescription( .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) .setColor(embedColors.colorWarning)
] ]
@@ -45,8 +45,14 @@ module.exports = {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({
name:
interaction.member.nickname ||
interaction.user.username,
iconURL: interaction.user.avatarURL()
})
.setDescription( .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) .setColor(embedColors.colorSuccess)
] ]
+1 -1
View File
@@ -195,7 +195,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
+10 -4
View File
@@ -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 // change paused state to opposite of current state
queue.node.setPaused(!queue.node.isPaused()); queue.node.setPaused(!queue.node.isPaused());
@@ -55,11 +61,11 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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) .setThumbnail(queue.currentTrack.thumbnail)
.setColor(embedColors.colorSuccess) .setColor(embedColors.colorSuccess)
@@ -70,11 +76,11 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .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) .setThumbnail(queue.currentTrack.thumbnail)
.setColor(embedColors.colorSuccess) .setColor(embedColors.colorSuccess)
+3 -3
View File
@@ -168,7 +168,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
@@ -191,7 +191,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
@@ -207,7 +207,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
+1 -1
View File
@@ -67,7 +67,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
+2 -2
View File
@@ -67,7 +67,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
@@ -103,7 +103,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
+2 -2
View File
@@ -72,7 +72,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(
@@ -87,7 +87,7 @@ module.exports = {
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.username, name: interaction.member.nickname || interaction.user.username,
iconURL: interaction.user.avatarURL() iconURL: interaction.user.avatarURL()
}) })
.setDescription( .setDescription(