Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telebot
- import os
- import time
- bot = telebot.TeleBot('1331182453:AAFJnouzpJeoi5jYKK8EddDFJ-t8ZI8bilc')
- @bot.message_handler(commands=['start'])
- def welcome(message):
- bot.send_message(message.chat.id, "NNNNNNNNNNNNNNNNNNNNNNN")
- @bot.message_handler(content_types=['text'])
- def display_matches(message):
- try:
- if message.text == 'a a a':
- files = str(os.listdir('music/')) # Список со всеми названиями файлов в директории
- key_words = message.text.split() # разбил сообщение на ключевые слова, для поиска в базе
- except:
- pass
- def find_file_ids(message):
- for file in os.listdir('music/'):
- if file.split('.')[0] == message.text:
- if file.split('.')[-1] == 'mp3':
- f = open('music/'+file, 'rb')
- msg = bot.send_audio(message.chat.id, f, None)
- bot.send_message(message.chat.id, msg.audio.file_id, reply_to_message_id=msg.message_id)
- time.sleep(3)
- pass
- bot.polling()
Advertisement
Add Comment
Please, Sign In to add comment