Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
fix: added configurable fallback icon url for use in embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusbegby committed Aug 29, 2023
1 parent e47256a commit 69fff97
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 22 deletions.
4 changes: 3 additions & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ module.exports.presenceStatusOptions = {
module.exports.embedOptions = {
info: {
fallbackThumbnailUrl:
'https://raw.githubusercontent.com/mariusbegby/cadence-discord-bot/main/assets/logo-rounded-128px.png'
'https://raw.githubusercontent.com/mariusbegby/cadence-discord-bot/main/assets/logo-rounded-128px.png',
fallbackIconUrl:
'https://raw.githubusercontent.com/mariusbegby/cadence-discord-bot/main/assets/discord-profile-icon.png'
},
colors: {
success: '#23A55A',
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/leave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the **\`/play\`** command!`
Expand Down
6 changes: 3 additions & 3 deletions src/interactions/commands/player/loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.success} Loop mode disabled**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${currentModeUserString} will no longer play on repeat!`
Expand All @@ -158,7 +158,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.autoplaying} Loop mode changed**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nWhen the queue is empty, similar tracks will start playing!`
Expand All @@ -176,7 +176,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.looping} Loop mode changed**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${modeUserString} will now play on repeat!`
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/nowplaying.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
iconURL: interaction.guild!.iconURL() || ''
iconURL: interaction.guild!.iconURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
(queue.node.isPaused()
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/pause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.pauseResumed} ${
Expand Down
6 changes: 3 additions & 3 deletions src/interactions/commands/player/play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.success} Added playlist to queue**\n**${durationFormat} [${
Expand Down Expand Up @@ -301,7 +301,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.audioStartedPlaying} Started playing**\n**${durationFormat} [${
Expand Down Expand Up @@ -330,7 +330,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`${embedOptions.icons.success} **Added to queue**\n**${durationFormat} [${track.title}](${
Expand Down
4 changes: 2 additions & 2 deletions src/interactions/commands/player/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
iconURL: interaction.guild!.iconURL() || ''
iconURL: interaction.guild!.iconURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`${repeatModeString}` + `**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
Expand Down Expand Up @@ -153,7 +153,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
iconURL: interaction.guild!.iconURL() || ''
iconURL: interaction.guild!.iconURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.audioPlaying} Now playing**\n` +
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.success} Removed track**\n**${durationFormat} [${removedTrack.title}](${
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/seek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.success} Seeking to duration**\nSeeking to **\`${durationString}\`** in current track.`
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/shuffle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${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\`**.`
Expand Down
4 changes: 2 additions & 2 deletions src/interactions/commands/player/skip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
Expand Down Expand Up @@ -156,7 +156,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/commands/player/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.success} Stopped playing**\nStopped playing audio and cleared the track queue.\n\nTo play more music, use the **\`/play\`** command!`
Expand Down
4 changes: 2 additions & 2 deletions src/interactions/commands/player/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.volumeMuted} Audio muted**\nPlayback audio has been muted, because volume was set to **\`${volume}%\`**.`
Expand All @@ -116,7 +116,7 @@ const command: CustomSlashCommandInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.volumeChanged} Volume changed**\nPlayback volume has been changed to **\`${volume}%\`**.`
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/components/filters-disable-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const component: CustomComponentInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.`
Expand Down
2 changes: 1 addition & 1 deletion src/interactions/components/nowplaying-skip-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const component: CustomComponentInteraction = {
new EmbedBuilder()
.setAuthor({
name: authorName,
iconURL: interaction.user.avatarURL() || ''
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
})
.setDescription(
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${
Expand Down
1 change: 1 addition & 0 deletions src/types/configTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface PresenceStatusOptions {
export interface EmbedOptions {
info: {
fallbackThumbnailUrl: string;
fallbackIconUrl: string;
};
colors: {
success: ColorResolvable;
Expand Down

0 comments on commit 69fff97

Please sign in to comment.