fix: remove async from class methods for getting author

This commit is contained in:
Marius Begby committed 2023-09-13 18:52:31 +02:00
1 parent 230ba5fd93
commit fe14fc308f
17 files changed
+23 -23

No files matched your search

+4 -4
View File
@@ -162,9 +162,9 @@ abstract class BaseInteractionWithEmbedResponse extends BaseInteraction {
super(); super();
} }
protected async getEmbedUserAuthor( protected getEmbedUserAuthor(
interaction: MessageComponentInteraction | ChatInputCommandInteraction interaction: MessageComponentInteraction | ChatInputCommandInteraction
): Promise<EmbedAuthorOptions> { ): EmbedAuthorOptions {
let authorName: string = ''; let authorName: string = '';
if (interaction.member instanceof GuildMember) { if (interaction.member instanceof GuildMember) {
authorName = interaction.member.nickname || interaction.user.username; authorName = interaction.member.nickname || interaction.user.username;
@@ -178,10 +178,10 @@ abstract class BaseInteractionWithEmbedResponse extends BaseInteraction {
}; };
} }
protected async getEmbedQueueAuthor( protected getEmbedQueueAuthor(
interaction: MessageComponentInteraction | ChatInputCommandInteraction, interaction: MessageComponentInteraction | ChatInputCommandInteraction,
queue: GuildQueue queue: GuildQueue
): Promise<EmbedAuthorOptions> { ): EmbedAuthorOptions {
return { return {
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`, name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
+1 -1
View File
@@ -144,7 +144,7 @@ class FiltersCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.` `**${this.embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.`
) )
+1 -1
View File
@@ -32,7 +32,7 @@ class LeaveCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the **\`/play\`** command!` `**${this.embedOptions.icons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the **\`/play\`** command!`
) )
+1 -1
View File
@@ -117,7 +117,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription(getChangedRepeatModeEmbedReply) .setDescription(getChangedRepeatModeEmbedReply)
.setColor(this.embedOptions.colors.success) .setColor(this.embedOptions.colors.success)
] ]
@@ -63,7 +63,7 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedQueueAuthor(interaction, queue)) .setAuthor(this.getEmbedQueueAuthor(interaction, queue))
.setDescription( .setDescription(
`${displayTrackPlayingStatus}\n` + `${displayTrackPlayingStatus}\n` +
`${displayTrackUrl}\n` + `${displayTrackUrl}\n` +
+1 -1
View File
@@ -33,7 +33,7 @@ class PauseCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.pauseResumed} ${ `**${this.embedOptions.icons.pauseResumed} ${
queue.node.isPaused() ? 'Paused Track' : 'Resumed track' queue.node.isPaused() ? 'Paused Track' : 'Resumed track'
+1 -1
View File
@@ -165,7 +165,7 @@ class PlayCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription(message) .setDescription(message)
.setThumbnail(this.getTrackThumbnailUrl(track)) .setThumbnail(this.getTrackThumbnailUrl(track))
.setColor(this.embedOptions.colors.success) .setColor(this.embedOptions.colors.success)
+2 -2
View File
@@ -59,7 +59,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedQueueAuthor(interaction, queue)) .setAuthor(this.getEmbedQueueAuthor(interaction, queue))
.setDescription( .setDescription(
`**${this.embedOptions.icons.audioPlaying} Now playing**\n` + `**${this.embedOptions.icons.audioPlaying} Now playing**\n` +
`${this.getFormattedTrackUrl(currentTrack)}\n` + `${this.getFormattedTrackUrl(currentTrack)}\n` +
@@ -89,7 +89,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedQueueAuthor(interaction, queue)) .setAuthor(this.getEmbedQueueAuthor(interaction, queue))
.setDescription( .setDescription(
`${this.getDisplayRepeatMode(queue.repeatMode)}` + `${this.getDisplayRepeatMode(queue.repeatMode)}` +
`**${this.embedOptions.icons.queue} Tracks in queue**\n` + `**${this.embedOptions.icons.queue} Tracks in queue**\n` +
+1 -1
View File
@@ -76,7 +76,7 @@ class RemoveCommand extends BaseSlashCommandInteraction {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.success} Removed track**\n${this.getDisplayTrackDurationAndUrl( `**${this.embedOptions.icons.success} Removed track**\n${this.getDisplayTrackDurationAndUrl(
removedTrack removedTrack
+1 -1
View File
@@ -143,7 +143,7 @@ class SeekCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.success} Seeking to duration**\nSeeking to **\`${durationString}\`** in current track.` `**${this.embedOptions.icons.success} Seeking to duration**\nSeeking to **\`${durationString}\`** in current track.`
) )
+1 -1
View File
@@ -33,7 +33,7 @@ class ShuffleCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.shuffled} Shuffled queue tracks**\nThe **${queue.tracks.data.length}** tracks in the queue has been shuffled.\n\nView the new queue order with **\`/queue\`**.` `**${this.embedOptions.icons.shuffled} Shuffled queue tracks**\nThe **${queue.tracks.data.length}** tracks in the queue has been shuffled.\n\nView the new queue order with **\`/queue\`**.`
) )
+2 -2
View File
@@ -56,7 +56,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${ `**${
this.embedOptions.icons.skipped this.embedOptions.icons.skipped
@@ -108,7 +108,7 @@ class SkipCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.skipped} Skipped track**\n${this.getDisplayTrackDurationAndUrl( `**${this.embedOptions.icons.skipped} Skipped track**\n${this.getDisplayTrackDurationAndUrl(
skippedTrack skippedTrack
+1 -1
View File
@@ -36,7 +36,7 @@ class StopCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.success} Stopped playing**\nStopped playing audio and cleared the track queue.\n\nTo play more music, use the **\`/play\`** command!` `**${this.embedOptions.icons.success} Stopped playing**\nStopped playing audio and cleared the track queue.\n\nTo play more music, use the **\`/play\`** command!`
) )
+2 -2
View File
@@ -75,7 +75,7 @@ class VolumeCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.volumeMuted} Audio muted**\nPlayback audio has been muted, because volume was set to **\`${volume}%\`**.` `**${this.embedOptions.icons.volumeMuted} Audio muted**\nPlayback audio has been muted, because volume was set to **\`${volume}%\`**.`
) )
@@ -88,7 +88,7 @@ class VolumeCommand extends BaseSlashCommandInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.volumeChanged} Volume changed**\nPlayback volume has been changed to **\`${volume}%\`**.` `**${this.embedOptions.icons.volumeChanged} Volume changed**\nPlayback volume has been changed to **\`${volume}%\`**.`
) )
@@ -32,7 +32,7 @@ class FiltersDisableButtonComponent extends BaseComponentInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.` `**${this.embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.`
) )
@@ -65,7 +65,7 @@ class FiltersSelectMenuComponent extends BaseComponentInteraction {
return await selectMenuInteraction.editReply({ return await selectMenuInteraction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${ `**${
this.embedOptions.icons.success this.embedOptions.icons.success
@@ -87,7 +87,7 @@ class NowplayingSkipButton extends BaseComponentInteraction {
return await interaction.editReply({ return await interaction.editReply({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setAuthor(await this.getEmbedUserAuthor(interaction)) .setAuthor(this.getEmbedUserAuthor(interaction))
.setDescription( .setDescription(
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${ `**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
skippedTrack.title skippedTrack.title