From bd09c8b9c49f2466e18b8379b434761b3a468048 Mon Sep 17 00:00:00 2001 From: Kylmakalle Date: Thu, 13 Jul 2017 19:58:38 +0300 Subject: [PATCH] Removed reundant escape function, tg style notify for music --- bot.py | 8 -------- vk_messages.py | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/bot.py b/bot.py index 32582dc..dcdd8fc 100644 --- a/bot.py +++ b/bot.py @@ -75,8 +75,6 @@ def request_user_dialogs(session, userid): dialogs = vk.API(session).messages.getDialogs(count=200) for chat in dialogs[1:]: if 'chat_id' in chat: - if chat['title'].replace('\\', ''): - chat['title'] = chat['title'].replace('\\', '') chat['title'] = replace_shields(chat['title']) order.append({'title': chat['title'], 'id': 'group' + str(chat['chat_id'])}) elif chat['uid'] > 0: @@ -136,8 +134,6 @@ def search_users(message, text): markup.add(types.InlineKeyboardButton('{} {}'.format(chat['first_name'], chat['last_name']), callback_data=str(chat['uid']))) elif chat['type'] == 'chat': - if chat['title'].replace('\\', ''): - chat['title'] = chat['title'].replace('\\', '') markup.add( types.InlineKeyboardButton(replace_shields(chat['title']), callback_data='group' + str(chat['chat_id']))) @@ -172,8 +168,6 @@ def callback_buttons(call): chat = vk.API(session).messages.getChat(chat_id=call.data.split('group')[1], fields=[]) bot.answer_callback_query(call.id, 'Вы в беседе {}'.format(replace_shields(chat['title']))).wait() - if chat['title'].replace('\\', ''): - chat['title'] = chat['title'].replace('\\', '') bot.send_message(call.from_user.id, 'Вы в беседе {}'.format(chat['title']), parse_mode='HTML').wait() @@ -275,8 +269,6 @@ def chat_command(message): if str(message.from_user.id) in currentchat: if 'group' in currentchat[str(message.from_user.id)]['id']: chat = currentchat[str(message.from_user.id)] - if chat['title'].replace('\\', ''): - chat['title'] = chat['title'].replace('\\', '') bot.send_message(message.from_user.id, 'Вы в беседе {}'.format(chat['title']), parse_mode='HTML').wait() diff --git a/vk_messages.py b/vk_messages.py index 4755be0..53e9d7c 100644 --- a/vk_messages.py +++ b/vk_messages.py @@ -102,7 +102,7 @@ def attachment_handler(m, user, bot, chat_id, mainmessage=None): elif attach['type'] == 'audio': data = add_user_info(m, user['first_name'], user[ - 'last_name']) + '🎵 {} - {}'.format( + 'last_name']) + '🎧 {} - {}'.format( attach['audio']['artist'].replace(' ', '%20'), attach['audio']['title'].replace(' ', '%20'), attach['audio']['artist'], attach['audio']['title']) + add_reply_info(m)