chatGPT-discord-bot
                                
                                
                                
                                    chatGPT-discord-bot copied to clipboard
                            
                            
                            
                        Cant install packages
user@container:~$ pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Collecting discord.py==2.1.0
  Downloading discord.py-2.1.0-py3-none-any.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 53.4 MB/s eta 0:00:00
Collecting revChatGPT==1.1.6
  Downloading revChatGPT-1.1.6-py3-none-any.whl (21 kB)
Collecting aiohttp<4,>=3.7.4
  Downloading aiohttp-3.8.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 79.7 MB/s eta 0:00:00
Collecting tiktoken
  Downloading tiktoken-0.2.0.tar.gz (21 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting openai
  Downloading openai-0.26.4.tar.gz (55 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.6/55.6 KB 7.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting charset-normalizer<3.0,>=2.0
  Downloading charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting async-timeout<5.0,>=4.0.0a3
  Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)
Collecting aiosignal>=1.1.2
  Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting frozenlist>=1.1.1
  Downloading frozenlist-1.3.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (159 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 159.2/159.2 KB 29.3 MB/s eta 0:00:00
Collecting attrs>=17.3.0
  Downloading attrs-22.2.0-py3-none-any.whl (60 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.0/60.0 KB 10.5 MB/s eta 0:00:00
Collecting multidict<7.0,>=4.5
  Downloading multidict-6.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (116 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 116.3/116.3 KB 24.3 MB/s eta 0:00:00
Collecting yarl<2.0,>=1.0
  Downloading yarl-1.8.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (261 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 261.1/261.1 KB 36.4 MB/s eta 0:00:00
Collecting tqdm
  Downloading tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.5/78.5 KB 17.5 MB/s eta 0:00:00
Collecting requests>=2.20
  Downloading requests-2.28.2-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.8/62.8 KB 13.6 MB/s eta 0:00:00
Collecting blobfile>=2
  Downloading blobfile-2.0.1-py3-none-any.whl (73 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.5/73.5 KB 13.9 MB/s eta 0:00:00
Collecting regex>=2022.1.18
  Downloading regex-2022.10.31-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (769 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 769.3/769.3 KB 72.0 MB/s eta 0:00:00
Collecting urllib3<3,>=1.25.3
  Downloading urllib3-1.26.14-py2.py3-none-any.whl (140 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.6/140.6 KB 26.5 MB/s eta 0:00:00
Collecting lxml~=4.9
  Downloading lxml-4.9.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (6.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.8/6.8 MB 23.7 MB/s eta 0:00:00
Collecting filelock~=3.0
  Downloading filelock-3.9.0-py3-none-any.whl (9.7 kB)
Collecting pycryptodomex~=3.8
  Downloading pycryptodomex-3.17-cp35-abi3-manylinux2014_aarch64.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 77.8 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
  Downloading certifi-2022.12.7-py3-none-any.whl (155 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.3/155.3 KB 2.2 MB/s eta 0:00:00
Collecting idna<4,>=2.5
  Downloading idna-3.4-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 KB 741.8 kB/s eta 0:00:00
Building wheels for collected packages: openai, tiktoken
  Building wheel for openai (pyproject.toml) ... done
  Created wheel for openai: filename=openai-0.26.4-py3-none-any.whl size=67722 sha256=f8e402656883c8aa60b48135c07480b9c0d7cfab8539201a0e06951842d35a2b
  Stored in directory: /home/container/.cache/pip/wheels/6c/15/7e/10950b76450328e6997e4319968c5412a28569ccf33b1e4a04
  Building wheel for tiktoken (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for tiktoken (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-39
      creating build/lib.linux-aarch64-cpython-39/tiktoken
      copying tiktoken/registry.py -> build/lib.linux-aarch64-cpython-39/tiktoken
      copying tiktoken/model.py -> build/lib.linux-aarch64-cpython-39/tiktoken
      copying tiktoken/load.py -> build/lib.linux-aarch64-cpython-39/tiktoken
      copying tiktoken/core.py -> build/lib.linux-aarch64-cpython-39/tiktoken
      copying tiktoken/__init__.py -> build/lib.linux-aarch64-cpython-39/tiktoken
      creating build/lib.linux-aarch64-cpython-39/tiktoken_ext
      copying tiktoken_ext/openai_public.py -> build/lib.linux-aarch64-cpython-39/tiktoken_ext
      running egg_info
      writing tiktoken.egg-info/PKG-INFO
      writing dependency_links to tiktoken.egg-info/dependency_links.txt
      writing requirements to tiktoken.egg-info/requires.txt
      writing top-level names to tiktoken.egg-info/top_level.txt
      reading manifest file 'tiktoken.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching 'Makefile'
      adding license file 'LICENSE'
      writing manifest file 'tiktoken.egg-info/SOURCES.txt'
      copying tiktoken/py.typed -> build/lib.linux-aarch64-cpython-39/tiktoken
      running build_ext
      running build_rust
      error: can't find Rust compiler
      
      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
      
      To update pip, run:
      
          pip install --upgrade pip
      
      and then retry package installation.
      
      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tiktoken
Successfully built openai
Failed to build tiktoken
ERROR: Could not build wheels for tiktoken, which is required to install pyproject.toml-based projects
WARNING: You are using pip version 22.0.4; however, version 23.0 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
user@container:~$ python3 main.py
Traceback (most recent call last):
  File "/home/container/main.py", line 1, in <module>
    from src import bot
  File "/home/container/src/bot.py", line 1, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'
                                    
                                    
                                    
                                
That was on pterodactyl, tried to run it on vps and managed to install all packages, but it doesnt work
2023-02-07 12:13:17 INFO     src.bot -> Username#tag : 'hello' (🤖|commands)
2023-02-07 12:13:22 ERROR    src.bot -> Error while sending message: 'str' object has no attribute 'removesuffix'
Traceback (most recent call last):
  File "/chatgpt/src/bot.py", line 32, in send_message
    response = f"{response}{await responses.handle_response(user_message)}"
  File "/chatgpt/src/responses.py", line 21, in handle_response
    response = await chatbot.ask(message)
  File "/usr/local/lib/python3.8/dist-packages/revChatGPT/Official.py", line 219, in ask
    return self._process_completion(user_request, completion, user=user)
  File "/usr/local/lib/python3.8/dist-packages/revChatGPT/Official.py", line 70, in _process_completion
    completion["choices"][0]["text"] = completion["choices"][0]["text"].removesuffix(
AttributeError: 'str' object has no attribute 'removesuffix'

seems you need to deploy it on x86 VPS
That was on pterodactyl, tried to run it on vps and managed to install all packages, but it doesnt work
2023-02-07 12:13:17 INFO src.bot -> Username#tag : 'hello' (🤖|commands) 2023-02-07 12:13:22 ERROR src.bot -> Error while sending message: 'str' object has no attribute 'removesuffix' Traceback (most recent call last): File "/chatgpt/src/bot.py", line 32, in send_message response = f"{response}{await responses.handle_response(user_message)}" File "/chatgpt/src/responses.py", line 21, in handle_response response = await chatbot.ask(message) File "/usr/local/lib/python3.8/dist-packages/revChatGPT/Official.py", line 219, in ask return self._process_completion(user_request, completion, user=user) File "/usr/local/lib/python3.8/dist-packages/revChatGPT/Official.py", line 70, in _process_completion completion["choices"][0]["text"] = completion["choices"][0]["text"].removesuffix( AttributeError: 'str' object has no attribute 'removesuffix'
But why this error?
Also btw is the chat gpt api free or do you need to pay for it to have your own discord bot?
@cary-sas @Zero6992
Also btw is the chat gpt api free or do you need to pay for it to have your own discord bot?
ChatGPT model does not require payment for usage, but it is temporarily out of service. I am considering a move to the GPT-3 model, which requires payment
That was on pterodactyl, tried to run it on vps and managed to install all packages, but it doesnt work
2023-02-07 12:13:17 INFO src.bot -> Username#tag : 'hello' (🤖|commands) 2023-02-07 12:13:22 ERROR src.bot -> Error while sending message: 'str' object has no attribute 'removesuffix' Traceback (most recent call last): File "/chatgpt/src/bot.py", line 32, in send_message response = f"{response}{await responses.handle_response(user_message)}" File "/chatgpt/src/responses.py", line 21, in handle_response response = await chatbot.ask(message) File "/usr/local/lib/python3.8/dist-packages/revChatGPT/Official.py", line 219, in ask return self._process_completion(user_request, completion, user=user) File "/usr/local/lib/python3.8/dist-packages/revChatGPT/Official.py", line 70, in _process_completion completion["choices"][0]["text"] = completion["choices"][0]["text"].removesuffix( AttributeError: 'str' object has no attribute 'removesuffix'
But why this error?
Can you fix it?
It's because the API isn't working that error?
use python version >= 3.9
root@node1: /chatgpt$ python3.9 main.py
Traceback (most recent call last):
File "/chatgpt/main.py", line 1, in 
Installed python 3.9 but with that it doesnt work,
python3 --version Python 3.8.10
python3.9 --version Python 3.9.5
Building wheel for tiktoken (pyproject.toml) ... error
  error: subprocess-exited-with-error
  × Building wheel for tiktoken (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-armv7l-cpython-311
      creating build/lib.linux-armv7l-cpython-311/tiktoken
      copying tiktoken/core.py -> build/lib.linux-armv7l-cpython-311/tiktoken
      copying tiktoken/registry.py -> build/lib.linux-armv7l-cpython-311/tiktoken
      copying tiktoken/model.py -> build/lib.linux-armv7l-cpython-311/tiktoken
      copying tiktoken/load.py -> build/lib.linux-armv7l-cpython-311/tiktoken
      copying tiktoken/__init__.py -> build/lib.linux-armv7l-cpython-311/tiktoken
      creating build/lib.linux-armv7l-cpython-311/tiktoken_ext
      copying tiktoken_ext/openai_public.py -> build/lib.linux-armv7l-cpython-311/tiktoken_ext
      running egg_info
      writing tiktoken.egg-info/PKG-INFO
      writing dependency_links to tiktoken.egg-info/dependency_links.txt
      writing requirements to tiktoken.egg-info/requires.txt
      writing top-level names to tiktoken.egg-info/top_level.txt
      reading manifest file 'tiktoken.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching 'Makefile'
      adding license file 'LICENSE'
      writing manifest file 'tiktoken.egg-info/SOURCES.txt'
      copying tiktoken/py.typed -> build/lib.linux-armv7l-cpython-311/tiktoken
      running build_ext
      running build_rust
      error: can't find Rust compiler
      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
      To update pip, run:
          pip install --upgrade pip
      and then retry package installation.
      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      [end of output]
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tiktoken
  Building wheel for frozenlist (pyproject.toml) ... done
  Created wheel for frozenlist: filename=frozenlist-1.3.3-cp311-cp311-linux_armv7l.whl size=145295 sha256=ba774b51ac95b72008f9c2d64dbb7748fd665b2c463e4cd0d84bcbbdb94a3e7f
  Stored in directory: /home/pi/.cache/pip/wheels/6d/ca/dc/7145d42507f8d0a6e5051c7a22bccff513e40e41bca8a26c7c
  Building wheel for multidict (pyproject.toml) ... done
  Created wheel for multidict: filename=multidict-6.0.4-cp311-cp311-linux_armv7l.whl size=111468 sha256=e41d0bcdd538f3bae75d29af8fda17c40ab7048c9312a9757922cc4abce31a33
  Stored in directory: /home/pi/.cache/pip/wheels/4d/e3/ef/b729f9f7591be012602e66b45ae0a9f974e5e7d7685852aa1c
  Building wheel for yarl (pyproject.toml) ... done
  Created wheel for yarl: filename=yarl-1.8.2-cp311-cp311-linux_armv7l.whl size=262621 sha256=82e7990672369dabe1fcec576e88f902d3bc569ab0ae34f1317327c2a6ed4768
  Stored in directory: /home/pi/.cache/pip/wheels/94/cd/3e/4b106d0785f75161a57556e0b5daffd2ad0e80a6db033e6087
Successfully built aiohttp frozenlist multidict yarl
Failed to build tiktoken
ERROR: Could not build wheels for tiktoken, which is required to install pyproject.toml-based projects
I still have this problem with tiktoken package (python version 3.11 and pip version 23.0)
Closing issue due to inactivity