Closed elderprice closed 1 year ago
raise TypeError(f'expected token to be a str, received {token.class.name} instead') TypeError: expected token to be a str, received NoneType instead
This seems to be the issue. What do I need to change?
It appears that your Python environment is a bit messy, it is recommended to use conda to open a fresh environment for running the program
Please provide your environment btw
DISCORD_BOT_TOKEN=""
UNOFFICIAL_PAID=True PUID= ACCESS_TOKEN= OPENAI_EMAIL="" OPENAI_PASSWORD=""
OPENAI_API_KEY=""
BARD_SESSION_ID=
CHAT_MODEL=OFFICIAL # OFFICIAL(OPENAI API), UNOFFICIAL(CHATGPT WEBSITE), Bard, Bing GPT_ENGINE=gpt-3.5-turbo # gpt-4(if you can access GPT-4 models) LOGGING=True REPLYING_ALL=False DISCORD_CHANNEL_ID= # channel using to send the starting-prompt REPLYING_ALL_DISCORD_CHANNEL_ID=
Is it this one?
It appears that your Python environment is a bit messy, it is recommended to use conda to open a fresh environment for running the program
I downloaded miniconda - can that work?
And do you mean I use that instead of the command prompt terminal?
Discord Bot token https://discord.com/developers/applications
No, I'm asking you to provide the environment where you execute the code
Did you follow the steps in the README and fill in the information in the .env
file?
Discord Bot token https://discord.com/developers/applications
No, I'm asking you to provide the environment where you execute the code
I just used the Terminal/Command prompt on Windows.
Did you follow the steps in the README and fill in the information in the
.env
file?
Yup - I just took out the token and API because it's public.
And you do rename the file to .env
right?
And you do rename the file to
.env
right?
Yes - actually, when I downloaded your latest file, it's already '.env'.
Although in an earlier version around March, I did see it was 'dev.env' and it had to be renamed.
And you do rename the file to
.env
right?Yes - actually, when I downloaded your latest file, it's already '.env'.
Although in an earlier version around March, I did see it was 'dev.env' and it had to be renamed.
No, I think Windows mistakenly recognized that file as having the name .env
and the extension dev
You need to create a new text file named .env
and copy the contents of the original .env
file into it.
I did that and saved it to a new '.env' file. It still shows the same error as above.
Your .evn file is still a text file you need to rename it by removing the .txt from the end of the name so it says ".env" instead of ".env.txt" ive attached a screenshot showing how it should look notice the file type is "ENV file". Hope this helps.
I did that and saved it to a new '.env' file. It still shows the same error as above.
it worked now. Thank you thank you thank you very much!
I've followed the directions to the T, but it doesn't allow me to start the bot based on the instructions. Upon asking ChatGPT, it says that there is wrong with my discord bot token. However, I literally just copy pasted it. How do I get it to work?
Here's the return after I try to run the bot:
C:\Users\joaqu\Desktop\GPT for Discord\chatGPT-discord-bot-main>python3 main.py 2023-04-23 15:55:12 INFO discord.client logging in using static token Traceback (most recent call last): File "C:\Users\joaqu\Desktop\GPT for Discord\chatGPT-discord-bot-main\main.py", line 30, in
bot.run_discord_bot()
File "C:\Users\joaqu\Desktop\GPT for Discord\chatGPT-discord-bot-main\src\bot.py", line 296, in run_discord_bot
client.run(TOKEN)
File "C:\Users\joaqu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 860, in run
asyncio.run(runner())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\Users\joaqu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 849, in runner
await self.start(token, reconnect=reconnect)
File "C:\Users\joaqu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 777, in start
await self.login(token)
File "C:\Users\joaqu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 609, in login
raise TypeError(f'expected token to be a str, received {token.class.name} instead')
TypeError: expected token to be a str, received NoneType instead