Removed reundant escape function, tg style notify for music

This commit is contained in:
Kylmakalle 2017-07-13 20:02:41 +03:00
parent 41c0e36838
commit 7bbf18375d
2 changed files with 1 additions and 9 deletions

8
bot.py
View File

@ -72,8 +72,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:
@ -133,8 +131,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'])))
@ -169,8 +165,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,
'<i>Вы в беседе {}</i>'.format(chat['title']),
parse_mode='HTML').wait()
@ -272,8 +266,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,
'<i>Вы в беседе {}</i>'.format(chat['title']),
parse_mode='HTML').wait()

View File

@ -103,7 +103,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']) + '🎵 <a href="https://m.vk.com/audio?q={}%20-%20{}">{} - {}</a>'.format(
'last_name']) + '🎧 <a href="https://m.vk.com/audio?q={}%20-%20{}">{} - {}</a>'.format(
attach['audio']['artist'].replace(' ', '%20'),
attach['audio']['title'].replace(' ', '%20'), attach['audio']['artist'],
attach['audio']['title']) + add_reply_info(m)