diff --git a/config.py b/config.py index 00c5302..69b05de 100644 --- a/config.py +++ b/config.py @@ -8,12 +8,12 @@ DATABASE_NAME = os.environ.get('POSTGRES_DB', 'tgvkbot') VK_APP_ID = os.environ.get('VK_APP_ID', '2685278') # Kate mobile -AUDIO_URL = os.environ.get('AUDIO_URL', 'http://thatmusic.akentev.com/id/{owner_id}/{audio_id}') +AUDIO_URL = os.environ.get('AUDIO_URL', '') AUDIO_ACCESS_URL = os.environ.get('AUDIO_ACCESS_URL', - 'http://thatmusic.akentev.com/access_id/{token}/{owner_id}/{audio_id}/{access_key}') -TOKEN_REFRESH_URL = os.environ.get('TOKEN_REFRESH_URL', 'http://thatmusic.akentev.com/refresh') -AUDIO_SEARCH_URL = os.environ.get('AUDIO_SEARCH_URL', 'https://thatmusic.akentev.com/search/') -AUDIO_PROXY_URL = os.environ.get('AUDIO_PROXY_URL', 'https://thatmusic.akentev.com/proxy/') + '') +TOKEN_REFRESH_URL = os.environ.get('TOKEN_REFRESH_URL', '') +AUDIO_SEARCH_URL = os.environ.get('AUDIO_SEARCH_URL', '') +AUDIO_PROXY_URL = os.environ.get('AUDIO_PROXY_URL', '') AUDIO_HEADERS = { 'user-agent': 'KateMobileAndroid/52.1 lite-445 (Android 4.4.2; SDK 19; x86; unknown Android SDK built for x86; en)'} diff --git a/vk_messages.py b/vk_messages.py index cc418d4..05dd265 100644 --- a/vk_messages.py +++ b/vk_messages.py @@ -575,11 +575,11 @@ async def process_message(msg, token=None, is_multichat=None, vk_chat_id=None, u # vk_msg_url_msg_id = vk_msg.get("id") or vk_msg.get("conversation_message_id") or "" - vk_msg_url = f'https://vk.com/im?msgid={vk_msg_url_msg_id}&sel=c{vk_msg_url_chat_id}' + vk_msg_url = f'https://vk.com/im?msgid={vk_msg_url_msg_id}&sel={vk_msg_url_chat_id}' disable_notify = force_disable_notify or bool(vk_msg.get('push_settings', False)) attaches_scheme = [] if vk_msg.get('attachments'): - attaches_scheme = [await process_attachment(attachment, token) for attachment in + attaches_scheme = [await process_attachment(attachment, token, vk_msg_url) for attachment in vk_msg['attachments']] if vk_msg.get('geo'): location = vk_msg['geo']['coordinates']['latitude'], vk_msg['geo']['coordinates']['longitude'] @@ -911,7 +911,7 @@ def form_audio_title(data: dict, delimer=' '): return result -async def process_attachment(attachment, token=None): +async def process_attachment(attachment, token=None, vk_msg_url=None): atype = attachment.get('type') if atype == 'photo': photo_url = attachment[atype]['sizes'][-1]['url'] @@ -1002,7 +1002,7 @@ async def process_attachment(attachment, token=None): except: pass - return {'content': 'Аудио', 'type': 'text'} + return {'content': f'🎵 {hlink(form_audio_title(attachment[atype]), vk_msg_url)}', 'type': 'text'} elif atype == 'video': title = attachment[atype]['title']