#๐Ÿ”’ Discord bot

283 messages ยท Page 1 of 1 (latest)

vocal mapleBOT
#

@unkempt rain

Python help channel opened

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.

unkempt rain
#

Im tryna make a discord bot

#

and pip and python is being recognized

#

but i have python in my vsc

#

its something on my pc

#

because my friend has the same code on a different bot and it is working

#

I tried venv and venv works but then it just messes up the whole code

#

it was legit working 2 days ago

#

then a popup that sad

#

"would you like to update pip or python or discord.py (it was one of the three) " and i was stressed out so i just put yes and now its broken

novel copper
#

what editor are you using ?

unkempt rain
#

idk how to check that lol

#

i came back to python after a year and a half

novel copper
#

what is the applicaion you are using to use python

unkempt rain
#

oh

#

vsc

novel copper
#

the reason i ask is that i know pycharm not VSC sorry

inland flint
#

what operating system do you have installed?

unkempt rain
#

windows 10

inland flint
#

okay, open your terminal and type in this command:
py --version

#

afterwards, run this command:
py -m pip --version

unkempt rain
#

ok

unkempt rain
unkempt rain
unkempt rain
#

yeah

#

idk what the fuck i did

inland flint
#

okay uh... try uninstalling python

unkempt rain
#

ok

#

like

#

all of them?

#

i got 2 or 3

inland flint
#

all of em, definitely. There's conflicting stuff going on with your path...

unkempt rain
#

alright

unkempt rain
#

ok its uninstalled

#

now what

#

do i reinstall it?

inland flint
#

yes try reinstalling the version of python that you need for your project

unkempt rain
#

ok

#

ok

#

its done

inland flint
unkempt rain
#

alright

#

what do i do now

#

i reinstalled 3.11.1

#

u there @inland flint ?

inland flint
#

yes

#

hi

#

okay, now try those two commands that I sent again

unkempt rain
#

its doing the same thing

#

ooh

#

its using python 313

#

i have 311

#

theres not even a 313 in the folder it lists

#

๐Ÿ˜ญ

#

@inland flint

#

u there

novel copper
unkempt rain
#

yes

#

it says

#

Unable to create process using 'C:\Users\Caleb\AppData\Local\Programs\Python\Python313\python.exe -m pip --version': The system cannot find the file specified.

#

and i dont even have python 313 installed

novel copper
#

did you download a new python or not

unkempt rain
#

yes

#

3.11.1

novel copper
#

did you move it to that folder? if you didn't not 100% sure but that might fix it

unkempt rain
#

wym

#

@inland flint

#

u there

#

????

inland bear
#

!dashmpip

vocal mapleBOT
#
Install packages with `python -m pip`

When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.

Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.

Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.

unkempt rain
#

it wont work

inland bear
#

tried using py?

unkempt rain
#

Unable to create process using 'C:\Users\Caleb\AppData\Local\Programs\Python\Python313\python.exe -m pip --version': The system cannot find the file specified.

#

i dont even have 313

#

its something with my path

#

i fucked up my path

inland bear
#

Is Python313 on it?

unkempt rain
#

no

#

it says 312

#

i dont even have 312 either

inland bear
#

You may need to restart your cmd after modifying it

unkempt rain
inland bear
#

What does py -0p do?

unkempt rain
#

but theres legit 1 file

#

311

inland bear
#

Unset the python env var

#

Also click the edit button on PATH and share a screenshot

wheat quarry
#

God, I hate windows

#

Imagine having to open a GUI to edit PATH

#

Insane

unkempt rain
#

i havent coded python in a year and a half

mighty torrent
#

you might want to reset your cohere token, cause it's public now, btw

unkempt rain
#

wheres a cohere token

wheat quarry
#

Lol

unkempt rain
#

whats a cohere token

#

bro

night pike
#

you should really reset that

unkempt rain
#

idk how to do that

#

brooo

wheat quarry
unkempt rain
#

oh

#

idc about cohere

wheat quarry
#

Go to dashboard or something

unkempt rain
#

why

#

idc about that

wheat quarry
#

If you have premium subscription or something, someone can DDoS with your token and bankrupt you

unkempt rain
#

oh

#

uhm

wheat quarry
#

Lol

unkempt rain
#

how do i do that

inland bear
#

Does pythons 3.12 and 3.13 show up in Apps?

unkempt rain
#

yes

inland bear
#

Uninstall them.

unkempt rain
#

lmao

inland bear
#

And I meant Settings > Apps

wheat quarry
inland bear
#

it's what replaced Add/Remove Programs

unkempt rain
#

i never bought it

wheat quarry
#

I have never heard of Cohere

unkempt rain
#

lmao

#

i dont have anything important in cohere

#

i jst made a trial key

#

which is completely free

#

@inland bear

inland bear
#

press ok

unkempt rain
wheat quarry
unkempt rain
#

my friend was tryna help me

#

he clearly didnt know a lot

inland bear
#

They don't. The question you should ask is "why did you uninstall so many python versions without the uninstaller?"

inland bear
#

rerun the installers and choose to repair installation, then you can properly uninstall it.

unkempt rain
#

alright

inland flint
#

hi im back, sorry i had to do some work

unkempt rain
#

unalive joy is helping me rn

#

i had 4 versions uninstalled inproperly

inland flint
#

oh boy okay uhhh

#

oh jeez

#

okay uh

#

go to this location in your folders:
C:\Users\noahj\AppData\Local\Programs\Python (but use your username instead of mine)

unkempt rain
#

ok

#

@inland bear

#

iu finished it

inland flint
#

how many installations are listed?

unkempt rain
#

i already fixed it

inland flint
#

oh you fixed it!

#

nice!

#

okay so now run this:
py -m pip --version

unkempt rain
#

i dont see launcher

inland flint
#

that's okay

unkempt rain
#

pip 22.3.1 from C:\Users\Caleb\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip (python 3.11)\

inland flint
#

great!!!!

unkempt rain
#

there we go

#

alright

#

i think i got it from here

#

lemme see rq

#

wait

#

pip still isnt recogonized

#

:/

#

'pip' is not recognized as an internal or external command,
operable program or batch file.

inland bear
#

Is Python\Python311\Scripts on your PATH?

unkempt rain
#

can you teach me how to do that in dms

#

cus i dont want to leak something again

#

i dont feel safe anymore

inland bear
#

Rerun the installer and make sure "Add scripts to PATH" is checked

unkempt rain
#

lmao

#

lemme see

#

ok

#

add py to evironmental

inland bear
#

Add Python to environment variables

unkempt rain
#

ok

#

IT WORKED

#

OMG TYSm

#

wait

#

lemme see if my bot works

#

tysm

#

wait dm me unalive

inland bear
#

you can do it here

unkempt rain
#

Traceback (most recent call last):
File "C:\Users\Caleb\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\http.py", line 300, in static_login
data = await self.request(Route('GET', '/users/@me'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Caleb\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\http.py", line 254, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized

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

Traceback (most recent call last):
File "c:\Users\Caleb\Downloads\bots\vtz_bot.py", line 380, in <module>
bot.run(TOKEN)
File "C:\Users\Caleb\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 723, in run
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\Caleb\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "C:\Users\Caleb\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 665, in start
await self.login(*args, bot=bot)
File "C:\Users\Caleb\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 511, in login
await self.http.static_login(token.strip(), bot=bot)
File "C:\Users\Caleb\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\http.py", line 304, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.

#

i dont want to leak anything

inland bear
#

Are you using dotenv?

unkempt rain
inland bear
#

your discord token is bad.

unkempt rain
#

wym?

#

thats the right discord token

inland bear
#

Aparently not.

unkempt rain
#

i just got it

#

it has to be

inland bear
#

any spaces in your string?

unkempt rain
#

nope

#

TOKEN = "my token"

inland bear
#

Did you copy the whole token?

unkempt rain
#

yes

#

theres no errors

#

except for that when i run it

#

and the script should be working cus i used it yesterday

#

until i updated something today

inland bear
#

Try switching to using dotenv

unkempt rain
#

aight

inland bear
#
import os

import dotenv
dotenv.load_dotenv()

TOKEN = os.environ["TOKEN"]
#

!pip python-dotenv

vocal mapleBOT
#

Read key-value pairs from a .env file and set them as environment variables

Released on <t:1742897696:D>.

unkempt rain
#

& C:/Users/Caleb/AppData/Local/Programs/Python/Python311/python.exe c:/Users/Caleb/Downloads/bots/vtz_bot.py
Traceback (most recent call last):
File "c:\Users\Caleb\Downloads\bots\vtz_bot.py", line 17, in <module>
TOKEN = os.environ["TOKEN"]
~~~~~~~~~~^^^^^^^^^
File "<frozen os>", line 679, in getitem
KeyError: 'TOKEN'

inland bear
#

You also need to create a file named .env ```properties
TOKEN=<your token here>

unkempt rain
#

i did

inland bear
#

Did you save?

unkempt rain
#

yes

#

wait

#

nvm

#

erm

vocal mapleBOT
# unkempt rain

Please react with โœ… to upload your file(s) to our paste bin, which is more accessible for some users.

unkempt rain
#

more errors happened

#

ruh roh

inland bear
#

Get a new token. It may have been invalidated.

unkempt rain
#

alright

#

lemme reset my pass

#

ok

#

i got a new token

#

put it in dotenv

#

and it still doin this

vocal mapleBOT
# unkempt rain

Please react with โœ… to upload your file(s) to our paste bin, which is more accessible for some users.

inland bear
#

Does your token have quotes in the .env file?

#

Should look like this without the periods.```
M.jM4.NDk0.NzU2.NTIx.Mzc3Nzky.CunGFQ.wUILz7z6HoJzVeq6pyHPmVgQgV4

#

(It's not a real token)

unkempt rain
#

yes

inland bear
#

Something about your token is wrong

unkempt rain
#

it cant be

#

i just copied it from the logs

#

and i tried it on an alt

#

it says the same thing

inland bear
#

The logs?

unkempt rain
#

yes

#

my code doesnt have 700 lines either

#

so its something in the pythons files

#

\Lib\site-packages\discord\client.py

inland bear
#

Can you share your vtz_bot.py file

#

!paste

vocal mapleBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

unkempt rain
#

its a self bot lmao

inland bear
#

!self

#

!rule 5 self bots aren't allowed

vocal mapleBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

unkempt rain
#

mine isnt malicious

inland bear
#

They're against discord TOS

unkempt rain
#

oh?

#

i didnt know that

#

am i getting banned

#

broooo

#

i didnt know that dude

inland bear
#

It just means we can't help you anymore.

unkempt rain
#

thats fine

inland bear
#

Don't continue to ask for help for it and you won't be banned.

unkempt rain
#

i just didnt know it was bannable

#

ill rework it into a normal bot

#

thanks for the help tho :/

vocal mapleBOT
#
Python help channel closed using Discord native close action

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.