Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cycle-five committed Jul 18, 2023
1 parent 0869971 commit bb1cdbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 7 additions & 4 deletions src/commands/play.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ use crate::{
errors::{verify, ParrotError},
guild::settings::{GuildSettings, GuildSettingsMap},
handlers::track_end::update_queue_messages,
messaging::message::ParrotMessage,
messaging::messages::{
PLAY_QUEUE, PLAY_TOP, SPOTIFY_AUTH_FAILED, TRACK_DURATION, TRACK_TIME_TO_PLAY,
},
messaging::{
message::ParrotMessage,
messages::{QUEUE_NO_SRC, QUEUE_NO_TITLE},
},
sources::{
file::{FileRestartable, FileSource},
spotify::{Spotify, SPOTIFY},
Expand Down Expand Up @@ -430,14 +433,14 @@ async fn create_queued_embed(
let mut embed = CreateEmbed::default();
let metadata = track.metadata().clone();

embed.thumbnail(&metadata.thumbnail.unwrap());
embed.thumbnail(&metadata.thumbnail.unwrap_or_default());

embed.field(
title,
&format!(
"[**{}**]({})",
metadata.title.unwrap(),
metadata.source_url.unwrap()
metadata.title.unwrap_or(QUEUE_NO_TITLE.to_string()),
metadata.source_url.unwrap_or(QUEUE_NO_SRC.to_string())
),
false,
);
Expand Down
9 changes: 6 additions & 3 deletions src/commands/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::{
guild::cache::GuildCacheMap,
handlers::track_end::ModifyQueueHandler,
messaging::messages::{
QUEUE_EXPIRED, QUEUE_NOTHING_IS_PLAYING, QUEUE_NOW_PLAYING, QUEUE_NO_SONGS, QUEUE_NO_TITLE,
QUEUE_PAGE, QUEUE_PAGE_OF, QUEUE_UP_NEXT,
QUEUE_EXPIRED, QUEUE_NOTHING_IS_PLAYING, QUEUE_NOW_PLAYING, QUEUE_NO_SONGS, QUEUE_NO_SRC,
QUEUE_NO_TITLE, QUEUE_PAGE, QUEUE_PAGE_OF, QUEUE_UP_NEXT,
},
utils::get_human_readable_timestamp,
};
Expand Down Expand Up @@ -152,7 +152,10 @@ pub fn create_queue_embed(tracks: &[TrackHandle], page: usize) -> CreateEmbed {
.title
.as_ref()
.unwrap_or(&String::from(QUEUE_NO_TITLE)),
metadata.source_url.as_ref().unwrap(),
metadata
.source_url
.as_ref()
.unwrap_or(&String::from(QUEUE_NO_SRC)),
get_human_readable_timestamp(metadata.duration)
)
} else {
Expand Down

0 comments on commit bb1cdbe

Please sign in to comment.