Add split command (#363)

Co-authored-by: Max Isom <hi@maxisom.me>
Co-authored-by: Max Isom <codetheweb@users.noreply.github.com>
This commit is contained in:
Hellyson Rodrigo Parteka 2022-03-09 23:47:52 -03:00 committed by GitHub
parent d438d46c09
commit 3dd1f21945
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 188 additions and 61 deletions

View file

@ -13,13 +13,13 @@ const getMaxSongTitleLength = (title: string) => {
return nonASCII.test(title) ? 28 : 48;
};
const getSongTitle = ({title, url}: QueuedSong, shouldTruncate = false) => {
const getSongTitle = ({title, url, offset}: QueuedSong, shouldTruncate = false) => {
const cleanSongTitle = title.replace(/\[.*\]/, '').trim();
const songTitle = shouldTruncate ? truncate(cleanSongTitle, getMaxSongTitleLength(cleanSongTitle)) : cleanSongTitle;
const youtubeId = url.length === 11 ? url : getYouTubeID(url) ?? '';
return `[${songTitle}](https://www.youtube.com/watch?v=${youtubeId})`;
return `[${songTitle}](https://www.youtube.com/watch?v=${youtubeId}${offset === 0 ? '' : '&t=' + String(offset)})`;
};
const getQueueInfo = (player: Player) => {