diff --git a/bot/handlers/inline_default/on_inline_default.py b/bot/handlers/inline_default/on_inline_default.py index d5d7dbf..9c4cb65 100644 --- a/bot/handlers/inline_default/on_inline_default.py +++ b/bot/handlers/inline_default/on_inline_default.py @@ -19,7 +19,7 @@ async def default_inline_query(inline_query: InlineQuery, bot: Bot): title=audio.name, description=audio.all_artists, thumb_url=audio.thumbnail, - document_url=audio.preview_url, + document_url=audio.preview_url or audio.thumbnail, mime_type='application/zip', reply_markup=InlineKeyboardMarkup( inline_keyboard=[ diff --git a/bot/modules/spotify/song.py b/bot/modules/spotify/song.py index ab328a6..5057f24 100644 --- a/bot/modules/spotify/song.py +++ b/bot/modules/spotify/song.py @@ -7,7 +7,7 @@ class SongItem: name: str id: str artists: list[str] - preview_url: str + preview_url: str | None thumbnail: str @classmethod @@ -16,7 +16,8 @@ class SongItem: name=song_item['name'], id=song_item['id'], artists=[artist['name'] for artist in song_item['artists']], - preview_url=song_item['preview_url'].split('?')[0], + preview_url=song_item['preview_url'].split('?')[0] if + song_item['preview_url'] is not None else None, thumbnail=song_item['album']['images'][1]['url'] )