You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@bot.message_handler(commands=['start'])
def start_command(message):
bot.reply_to(message, "Привет! Я бот, который сможет ответить на любой твой вопрос!")
@bot.message_handler(content_types=['text'])
def handle_text(message):
text = message.text
root@HostBots:~/anya# python3 anya.py
/usr/lib/python3/dist-packages/requests/init.py:89: RequestsDependencyWarning: urllib3 (2.1.0) or chardet (3.0.4) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
File "anya.py", line 42, in
bot.polling()
File "/usr/local/lib/python3.8/dist-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 "/usr/local/lib/python3.8/dist-packages/telebot/init.py",
line 1118, in __threaded_polling
raise e
File "/usr/local/lib/python3.8/dist-packages/telebot/init.py",
line 1074, in __threaded_polling
self.worker_pool.raise_exceptions()
File "/usr/local/lib/python3.8/dist-packages/telebot/util.py", line 147, in raise_exceptions
raise self.exception_info
File "/usr/local/lib/python3.8/dist-packages/telebot/util.py", line 90, in run
task(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/telebot/init.py",
line 6801, in _run_middlewares_and_handler
result = handler'function'
File "anya.py", line 27, in handle_text
response = g4f.ChatCompletion.create(
File "/usr/local/lib/python3.8/dist-packages/g4f/init.py", line 76, in create
return result if stream else ''.join(result)
File "/usr/local/lib/python3.8/dist-packages/g4f/Provider/retry_provider.py", line 59, in create_completion
self.raise_exceptions()
File "/usr/local/lib/python3.8/dist-packages/g4f/Provider/retry_provider.py", line 87, in raise_exceptions
raise RuntimeError("\n".join(["RetryProvider failed:"] + [
RuntimeError: RetryProvider failed:
Bing: ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: ', url=URL('https://sydney.bing.com/sydney/DeleteSingleConversation')
Liaobots: ClientResponseError: 401, message='Unauthorized', url=URL('https://liaobots.work/api/user')
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using the code:
import logging
import telebot
import g4f
bot = telebot.TeleBot('')
logging.basicConfig(level=logging.INFO)
@bot.message_handler(commands=['start'])
def start_command(message):
bot.reply_to(message, "Привет! Я бот, который сможет ответить на любой твой вопрос!")
@bot.message_handler(content_types=['text'])
def handle_text(message):
text = message.text
bot.polling()
But here I get an error
root@HostBots:~/anya# python3 anya.py
/usr/lib/python3/dist-packages/requests/init.py:89: RequestsDependencyWarning: urllib3 (2.1.0) or chardet (3.0.4) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
File "anya.py", line 42, in
bot.polling()
File "/usr/local/lib/python3.8/dist-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 "/usr/local/lib/python3.8/dist-packages/telebot/init.py",
line 1118, in __threaded_polling
raise e
File "/usr/local/lib/python3.8/dist-packages/telebot/init.py",
line 1074, in __threaded_polling
self.worker_pool.raise_exceptions()
File "/usr/local/lib/python3.8/dist-packages/telebot/util.py", line 147, in raise_exceptions
raise self.exception_info
File "/usr/local/lib/python3.8/dist-packages/telebot/util.py", line 90, in run
task(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/telebot/init.py",
line 6801, in _run_middlewares_and_handler
result = handler'function'
File "anya.py", line 27, in handle_text
response = g4f.ChatCompletion.create(
File "/usr/local/lib/python3.8/dist-packages/g4f/init.py", line 76, in create
return result if stream else ''.join(result)
File "/usr/local/lib/python3.8/dist-packages/g4f/Provider/retry_provider.py", line 59, in create_completion
self.raise_exceptions()
File "/usr/local/lib/python3.8/dist-packages/g4f/Provider/retry_provider.py", line 87, in raise_exceptions
raise RuntimeError("\n".join(["RetryProvider failed:"] + [
RuntimeError: RetryProvider failed:
Bing: ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: ', url=URL('https://sydney.bing.com/sydney/DeleteSingleConversation')
Liaobots: ClientResponseError: 401, message='Unauthorized', url=URL('https://liaobots.work/api/user')
Beta Was this translation helpful? Give feedback.
All reactions