Fix results not shown when no preview_url
This commit is contained in:
@@ -19,7 +19,7 @@ async def default_inline_query(inline_query: InlineQuery, bot: Bot):
|
|||||||
title=audio.name,
|
title=audio.name,
|
||||||
description=audio.all_artists,
|
description=audio.all_artists,
|
||||||
thumb_url=audio.thumbnail,
|
thumb_url=audio.thumbnail,
|
||||||
document_url=audio.preview_url,
|
document_url=audio.preview_url or audio.thumbnail,
|
||||||
mime_type='application/zip',
|
mime_type='application/zip',
|
||||||
reply_markup=InlineKeyboardMarkup(
|
reply_markup=InlineKeyboardMarkup(
|
||||||
inline_keyboard=[
|
inline_keyboard=[
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class SongItem:
|
|||||||
name: str
|
name: str
|
||||||
id: str
|
id: str
|
||||||
artists: list[str]
|
artists: list[str]
|
||||||
preview_url: str
|
preview_url: str | None
|
||||||
thumbnail: str
|
thumbnail: str
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -16,7 +16,8 @@ class SongItem:
|
|||||||
name=song_item['name'],
|
name=song_item['name'],
|
||||||
id=song_item['id'],
|
id=song_item['id'],
|
||||||
artists=[artist['name'] for artist in song_item['artists']],
|
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']
|
thumbnail=song_item['album']['images'][1]['url']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user