Removed reundant escape function, tg style notify for music
This commit is contained in:
parent
084f895897
commit
bd09c8b9c4
8
bot.py
8
bot.py
@ -75,8 +75,6 @@ def request_user_dialogs(session, userid):
|
|||||||
dialogs = vk.API(session).messages.getDialogs(count=200)
|
dialogs = vk.API(session).messages.getDialogs(count=200)
|
||||||
for chat in dialogs[1:]:
|
for chat in dialogs[1:]:
|
||||||
if 'chat_id' in chat:
|
if 'chat_id' in chat:
|
||||||
if chat['title'].replace('\\', ''):
|
|
||||||
chat['title'] = chat['title'].replace('\\', '')
|
|
||||||
chat['title'] = replace_shields(chat['title'])
|
chat['title'] = replace_shields(chat['title'])
|
||||||
order.append({'title': chat['title'], 'id': 'group' + str(chat['chat_id'])})
|
order.append({'title': chat['title'], 'id': 'group' + str(chat['chat_id'])})
|
||||||
elif chat['uid'] > 0:
|
elif chat['uid'] > 0:
|
||||||
@ -136,8 +134,6 @@ def search_users(message, text):
|
|||||||
markup.add(types.InlineKeyboardButton('{} {}'.format(chat['first_name'], chat['last_name']),
|
markup.add(types.InlineKeyboardButton('{} {}'.format(chat['first_name'], chat['last_name']),
|
||||||
callback_data=str(chat['uid'])))
|
callback_data=str(chat['uid'])))
|
||||||
elif chat['type'] == 'chat':
|
elif chat['type'] == 'chat':
|
||||||
if chat['title'].replace('\\', ''):
|
|
||||||
chat['title'] = chat['title'].replace('\\', '')
|
|
||||||
markup.add(
|
markup.add(
|
||||||
types.InlineKeyboardButton(replace_shields(chat['title']),
|
types.InlineKeyboardButton(replace_shields(chat['title']),
|
||||||
callback_data='group' + str(chat['chat_id'])))
|
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=[])
|
chat = vk.API(session).messages.getChat(chat_id=call.data.split('group')[1], fields=[])
|
||||||
bot.answer_callback_query(call.id,
|
bot.answer_callback_query(call.id,
|
||||||
'Вы в беседе {}'.format(replace_shields(chat['title']))).wait()
|
'Вы в беседе {}'.format(replace_shields(chat['title']))).wait()
|
||||||
if chat['title'].replace('\\', ''):
|
|
||||||
chat['title'] = chat['title'].replace('\\', '')
|
|
||||||
bot.send_message(call.from_user.id,
|
bot.send_message(call.from_user.id,
|
||||||
'<i>Вы в беседе {}</i>'.format(chat['title']),
|
'<i>Вы в беседе {}</i>'.format(chat['title']),
|
||||||
parse_mode='HTML').wait()
|
parse_mode='HTML').wait()
|
||||||
@ -275,8 +269,6 @@ def chat_command(message):
|
|||||||
if str(message.from_user.id) in currentchat:
|
if str(message.from_user.id) in currentchat:
|
||||||
if 'group' in currentchat[str(message.from_user.id)]['id']:
|
if 'group' in currentchat[str(message.from_user.id)]['id']:
|
||||||
chat = currentchat[str(message.from_user.id)]
|
chat = currentchat[str(message.from_user.id)]
|
||||||
if chat['title'].replace('\\', ''):
|
|
||||||
chat['title'] = chat['title'].replace('\\', '')
|
|
||||||
bot.send_message(message.from_user.id,
|
bot.send_message(message.from_user.id,
|
||||||
'<i>Вы в беседе {}</i>'.format(chat['title']),
|
'<i>Вы в беседе {}</i>'.format(chat['title']),
|
||||||
parse_mode='HTML').wait()
|
parse_mode='HTML').wait()
|
||||||
|
@ -102,7 +102,7 @@ def attachment_handler(m, user, bot, chat_id, mainmessage=None):
|
|||||||
|
|
||||||
elif attach['type'] == 'audio':
|
elif attach['type'] == 'audio':
|
||||||
data = add_user_info(m, user['first_name'], user[
|
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']['artist'].replace(' ', '%20'),
|
||||||
attach['audio']['title'].replace(' ', '%20'), attach['audio']['artist'],
|
attach['audio']['title'].replace(' ', '%20'), attach['audio']['artist'],
|
||||||
attach['audio']['title']) + add_reply_info(m)
|
attach['audio']['title']) + add_reply_info(m)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user