#๐ Need help coding
79 messages ยท Page 1 of 1 (latest)
@shadow stag
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
you should be using a .env file to have your token
can you send the rest of your code (without the token)
Wdym?
I'm using basic code
Like the one provided
a .env file is usually how people keep private keys
So, bot.env?
im just telling you best practice lol
File name?
just .env
to read from in, you need to
pip install python-dotenv
Ok, then what do I do with that file?
to read from the .env file, make sure its in the same root folder, then
from dotenv import load_dotenv
import os
load_dotenv()
token = os.getenv("DISCORD_TOKEN")
write this in the .env file
DISCORD_TOKEN=put your token here
Add this
Right?
put that in the .env file yes
you can replace "DISCORD_TOKEN" with anything if you want
Kk
then access it with os.getenv("put the same name here")
this error is probably because you didnt close the string
Do I download this in my main file?
wdym by your main file?
what ide/code editor are you using
Py
what are you trying to do with discord
like the code editor
what are you using to code it
Go*
o alright
Virtual studio and python
you can then put this in your bot file
Kk, this downloaded
Lemme do file now
@errant copper ive done this
the .env file should be in the same folder as your bot file
ohh
or you cant read it
@errant copper now it says Bash: pip: command not found
how did you install the discord module?
Don't think so
ah
Sorry man, I'm super new..
could you try py -m pip install python-dotenv
This is super hard..
Not found
@errant copper so uh, what do I do..
did you install python in your system?
Yeah
where did you install it from?
hm
try
python -v
py -v
py3 -v
python3 -v
I dont know what python is called on your system, if any of these give you the python version, its the correct one
Kk I'll try that when I can
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.