Code Monkey home page Code Monkey logo

chatgptbot's People

Contributors

code-monad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

chatgptbot's Issues

Hello there about decoder error

I don't know coding and followed the steps to install this. Everything was okay until I typed python main.py

Here is the traceback:

C:\Users\User\python-telegram-bot\ChatGPT>python main.py
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\toml\decoder.py", line 511, in loads
ret = decoder.load_line(line, currentlevel, multikey,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\toml\decoder.py", line 778, in load_line value, vtype = self.load_value(pair[1], strictly_valid)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\toml\decoder.py", line 880, in load_value
return (self.load_array(v), "array")
^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\toml\decoder.py", line 1026, in load_array
nval, ntype = self.load_value(a[i])
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\toml\decoder.py", line 918, in load_value
v = int(v, 0)
^^^^^^^^^
ValueError: invalid literal for int() with base 0: '<5045976266>'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\User\python-telegram-bot\ChatGPT\main.py", line 275, in
config_map = toml.load(config_file)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\toml\decoder.py", line 134, in load
return loads(ffile.read(), _dict, decoder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\toml\decoder.py", line 514, in loads
raise TomlDecodeError(str(err), original, pos)
toml. decoder.TomlDecodeError: invalid literal for int() with base 0: '<5045976266>' (line 3 column 1 char 63)

I don't know how to fix this. Please give me a hand if you have any ideas. Thank you.

AttributeError: 'NoneType' object has no attribute 'run_repeating'

成功安装了前面的所有命令并且修改了五个部分的信息并重命名,运行main.py报错:
In [2]: run main.py
2022-12-14 16:50:25.821 | DEBUG | main::281 - Load from config.toml...
2022-12-14 16:50:25.824 | DEBUG | main::288 - Telegram Bot token: 5840358179:AAG_3RhS9R5D-sVLRigu39czgydQ4Tof81w
2022-12-14 16:50:25.825 | DEBUG | main::289 - Allowed users' ID: [5453144673]
2022-12-14 16:50:25.827 | INFO | main::293 - Loading memories from memories.sav
2022-12-14 16:50:25.831 | INFO | main::295 - Memories:{}
C:\Users\lun54\ChatGPTBot\main.py:320: PTBUserWarning: No JobQueue set up. To use JobQueue, you must install PTB via pip install python-telegram-bot[job_queue].
application.job_queue.run_repeating(refresh_session, interval=20 * 60, first=20 * 60)

AttributeError Traceback (most recent call last)
File ~\ChatGPTBot\main.py:320, in
318 application.add_handler(detail_handler)
319 application.add_error_handler(error_handler)
--> 320 application.job_queue.run_repeating(refresh_session, interval=20 * 60, first=20 * 60)
322 application.run_polling()

AttributeError: 'NoneType' object has no attribute 'run_repeating'

初始化成功后,对话报错。Illegal header value b'Bearer '

Python version 3.10.8 报错信息如下,

An exception was raised while handling an update
Traceback (most recent call last):
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 121, in _send_request_headers
    event = h11.Request(
  File "/home/mei/.local/lib/python3.10/site-packages/h11/_events.py", line 96, in __init__
    self, "headers", normalize_and_validate(headers, _parsed=_parsed)
  File "/home/mei/.local/lib/python3.10/site-packages/h11/_headers.py", line 164, in normalize_and_validate
    validate(_field_value_re, value, "Illegal header value {!r}", value)
  File "/home/mei/.local/lib/python3.10/site-packages/h11/_util.py", line 91, in validate
    raise LocalProtocolError(msg)
h11._util.LocalProtocolError: Illegal header value b'Bearer '

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
    raise exc
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 90, in handle_async_request
    return await self._connection.handle_async_request(request)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 112, in handle_async_request
    raise exc
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 80, in handle_async_request
    await self._send_request_headers(**kwargs)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 120, in _send_request_headers
    with map_exceptions({h11.LocalProtocolError: LocalProtocolError}):
  File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/mei/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc)
httpcore.LocalProtocolError: Illegal header value b'Bearer '

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/mei/.local/lib/python3.10/site-packages/python_telegram_bot-20.0a6-py3.10.egg/telegram/ext/_application.py", line 1057, in process_update
    await coroutine
  File "/home/mei/.local/lib/python3.10/site-packages/python_telegram_bot-20.0a6-py3.10.egg/telegram/ext/_handler.py", line 143, in handle_update
    return await self.callback(update, context)
  File "/mnt/hdd/code/ChatGPTBot/main.py", line 203, in chat
    reply = await chatbot.get_chat_response(update.message.text)
  File "/home/mei/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 265, in get_chat_response
    return await self.__get_chat_text(data)
  File "/home/mei/.local/lib/python3.10/site-packages/revChatGPT/revChatGPT.py", line 205, in __get_chat_text
    response = await s.post(
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_client.py", line 1848, in post
    return await self.request(
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_client.py", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_client.py", line 1620, in send
    response = await self._send_handling_auth(
  File "/home/mei/.local/lib/python3.10/site-packages/httpx/_client.py", line 1648, in _send_handling_auth
    response = await self._send_handling_r

please help me look

python main.py
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\ChatGPTBot-master\ChatGPTBot-master\main.py", line 12, in
from revChatGPT.revChatGPT import AsyncChatbot as Chatbot
File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\revchatgpt-0.0.42.1-py3.10.egg\revChatGPT\revChatGPT.py", line 14, in
ModuleNotFoundError: No module named 'OpenAIAuth'

ConnectionRefusedError: [WinError 1225] 远程计算机拒绝网络连接

我使用了代理,python版本为3.10,但是运行出现下面的错误,可以帮我一下吗
INFO | main::292 - Memories:{}
2022-12-13 23:12:19,775 - apscheduler.scheduler - INFO - Adding job tentatively -- it will be properly scheduled when the scheduler starts
Traceback (most recent call last):
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\anyio-3.6.2-py3.10.egg\anyio_core_sockets.py", line 164, in try_connect
stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\anyio-3.6.2-py3.10.egg\anyio_backends_asyncio.py", line 1691, in connect_tcp
await get_running_loop().create_connection(
File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 1070, in create_connection
raise exceptions[0]
File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 1054, in create_connection
sock = await self._connect_sock(
File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 963, in _connect_sock
await self.sock_connect(sock, address)
File "C:\Program Files\Python310\lib\asyncio\proactor_events.py", line 709, in sock_connect
return await self._proactor.connect(sock, address)
File "C:\Program Files\Python310\lib\asyncio\windows_events.py", line 821, in _poll
value = callback(transferred, key, ov)
File "C:\Program Files\Python310\lib\asyncio\windows_events.py", line 608, in finish_connect
ov.getresult()
ConnectionRefusedError: [WinError 1225] 远程计算机拒绝网络连接。

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpcore-0.16.2-py3.10.egg\httpcore_exceptions.py", line 10, in map_exceptions
yield
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpcore-0.16.2-py3.10.egg\httpcore\backends\asyncio.py", line 109, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\anyio-3.6.2-py3.10.egg\anyio_core_sockets.py", line 222, in connect_tcp
raise OSError("All connection attempts failed") from cause
OSError: All connection attempts failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpx-0.23.1-py3.10.egg\httpx_transports\default.py", line 60, in map_httpcore_exceptions
yield
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpx-0.23.1-py3.10.egg\httpx_transports\default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpcore-0.16.2-py3.10.egg\httpcore_async\connection_pool.py", line 253, in handle_async_request
raise exc
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpcore-0.16.2-py3.10.egg\httpcore_async\connection_pool.py", line 237, in handle_async_request
response = await connection.handle_async_request(request)
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpcore-0.16.2-py3.10.egg\httpcore_async\socks_proxy.py", line 290, in handle_async_request
raise exc
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpcore-0.16.2-py3.10.egg\httpcore_async\socks_proxy.py", line 225, in handle_async_request
stream = await self._network_backend.connect_tcp(**kwargs)
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpcore-0.16.2-py3.10.egg\httpcore\backends\auto.py", line 29, in connect_tcp
return await self._backend.connect_tcp(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpcore-0.16.2-py3.10.egg\httpcore\backends\asyncio.py", line 107, in connect_tcp
with map_exceptions(exc_map):
File "C:\Program Files\Python310\lib\contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpcore-0.16.2-py3.10.egg\httpcore_exceptions.py", line 14, in map_exceptions
raise to_exc(exc)
httpcore.ConnectError: All connection attempts failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\request_httpxrequest.py", line 183, in do_request
res = await self._client.request(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpx-0.23.1-py3.10.egg\httpx_client.py", line 1533, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpx-0.23.1-py3.10.egg\httpx_client.py", line 1620, in send
response = await self._send_handling_auth(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpx-0.23.1-py3.10.egg\httpx_client.py", line 1648, in _send_handling_auth
response = await self._send_handling_redirects(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpx-0.23.1-py3.10.egg\httpx_client.py", line 1685, in _send_handling_redirects
response = await self._send_single_request(request)
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpx-0.23.1-py3.10.egg\httpx_client.py", line 1722, in _send_single_request
response = await transport.handle_async_request(request)
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpx-0.23.1-py3.10.egg\httpx_transports\default.py", line 352, in handle_async_request
with map_httpcore_exceptions():
File "C:\Program Files\Python310\lib\contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\httpx-0.23.1-py3.10.egg\httpx_transports\default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\LENOVO\Desktop\ChatGPTBot-master\main.py", line 319, in
application.run_polling()
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\ext_application.py", line 685, in run_polling
return self.__run(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\ext_application.py", line 873, in __run
raise exc
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\ext_application.py", line 862, in __run
loop.run_until_complete(self.initialize())
File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\ext_application.py", line 372, in initialize
await self.bot.initialize()
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\ext_extbot.py", line 252, in initialize
await super().initialize()
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram_bot.py", line 518, in initialize
await self.get_me()
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\ext_extbot.py", line 1647, in get_me
return await super().get_me(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram_bot.py", line 313, in decorator
result = await func(*args, **kwargs) # skipcq: PYL-E1102
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram_bot.py", line 663, in get_me
result = await self._post(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram_bot.py", line 395, in _post
return await self._do_post(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\ext_extbot.py", line 306, in _do_post
return await super()._do_post(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram_bot.py", line 426, in _do_post
return await request.post(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\request_baserequest.py", line 167, in post
result = await self._request_wrapper(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\request_baserequest.py", line 290, in _request_wrapper
raise exc
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\request_baserequest.py", line 276, in _request_wrapper
code, payload = await self.do_request(
File "C:\Users\LENOVO\AppData\Roaming\Python\Python310\site-packages\python_telegram_bot-20.0a6-py3.10.egg\telegram\request_httpxrequest.py", line 204, in do_request
raise NetworkError(f"httpx HTTPError: {err}") from err

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.