TELEBOT
PYTHON 3.8.0
import telebot
import config
import sounddevice as sd
from scipy.io.wavfile import write
bot = telebot.TeleBot(config.TOKEN)
fs = 44100 # Частота дискретизации
seconds = 15 # Продолжительность записи
myrecording = sd.rec(int(seconds * fs), samplerate=fs, channels=2)
sd.wait() # Дождитесь окончания записи
print("ОКОНЧЕННО")
write('minecraft.mp3', fs, myrecording) # Сохранить как WAV файл
keyboard = telebot.types.ReplyKeyboardMarkup(True, False)
keyboard.row("ПОЛУЧИТЬ")
@bot.message_handler(commands=["start"])
def start_message(message):
chatId = message.chat.chatId
text = message.text.lower
bot.send_message(chatId, "Hi", reply_markup=keyboard)
@bot.message_handler(content_types=["text"])
def send_nessage(message):
chatId = message.chat.Id
text.message.text.lower()
print(text)
if text == "ПОЛУЧИТЬ":
bot.send_nessage(chatId, "FILE")
bot.send_audio(chatId, open("minecraft.wav", "rb"))
elif text == "пока":
bot.send_message(chatId, "nokall O")
bot.polling()
pip install pyTelegramBotAPI делал, pip uninstall telebot
C:\Users\ilbaa\OneDrive\Рабочий стол\ПРОСЛУШКА>python main.py
ОКОНЧЕННО
Traceback (most recent call last):
File "main.py", line 38, in <module>
bot.polling()
File "C:\Users\ilbaa\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\__init__.py", line 1043, in polling
self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,
File "C:\Users\ilbaa\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\__init__.py", line 1118, in __threaded_polling
raise e
File "C:\Users\ilbaa\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\__init__.py", line 1074, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\ilbaa\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\util.py", line 156, in raise_exceptions
raise self.exception_info
File "C:\Users\ilbaa\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\util.py", line 100, in run
task(*args, **kwargs)
File "C:\Users\ilbaa\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\__init__.py", line 6395, in _run_middlewares_and_handler
result = handler['function'](message)
File "main.py", line 22, in start_message
chatId = message.chat.chatId
AttributeError: 'Chat' object has no attribute 'chatId'