File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -91,27 +91,29 @@ export async function spotifyPlaylistHandler(
91
91
) ;
92
92
}
93
93
94
- do {
94
+ let offset = playlist . tracks . offset ;
95
+ while ( offset < playlist . tracks . total ) {
95
96
await replyWithMutlipleSongs ( ctx , playlist . tracks , {
96
97
disable_notification : true ,
97
98
} ) ;
99
+ offset += playlist . tracks . limit ;
98
100
if ( playlist . tracks . next ) {
99
101
playlist . tracks = await spotify . playlists . getPlaylistItems (
100
102
playlist . id ,
101
103
undefined ,
102
104
undefined ,
103
105
playlist . tracks . limit as 50 | undefined ,
104
- playlist . tracks . offset + playlist . tracks . limit
106
+ offset
105
107
) ;
106
108
}
107
- } while ( playlist . tracks . next ) ;
109
+ }
108
110
await ctx . reply ( `🎵 ${ playlist . name } playlist downloaded` ) ;
109
111
} else {
110
112
const reply_markup = {
111
113
inline_keyboard : [
112
114
[
113
115
{
114
- text : `Download ${ playlist . tracks . items . length } songs` ,
116
+ text : `Download ${ playlist . tracks . total } songs` ,
115
117
callback_data : `spotify----${ playlist . id } ----playlist-dl` ,
116
118
} ,
117
119
] ,
You can’t perform that action at this time.
0 commit comments