New Programmer, Discord Bot Error, Help Needed, (Windows 10)

Reading prerequisites:
To start, there will be a lot of issues in here, I honestly am a little in fear of what is to come, but that’s exactly why I am here, so here be the things to keep in mind:

  • I am an amateur programmer
  • The computer I have is a refab, that may have to deal with some of the issue I am having
  • I have not had much outside help from before, this is the first major time I have publicly asked for help,

Okay so here we go

I installed python, I believe I had 3.8.5 at the time, and had the intention of making some discord bots, (My used sources and screenshots will be linked below), I had first visited link 1, and the code hadn’t worked, the code is in Photo 1, it hadn’t worked. I had asked a friend what could be wrong, I was told to install the discord commands to python through my command prompt (not sure if this terminology is correct but hopefully you get the point). For some odd reason the given command on Link 1 wouldn’t work, so recently I had found link 2 and used both command prompt commands for windows, it still hadn’t worked, not displaying the error message seen in Photo 2. At this point my friend told me to run commands instead of events, which worked fine, except for the fact that running it in commands instead of events does not do the task I was hoping to program the bot to do. And yes, I know this next part is a rather dumb choice, as I kinda screwed up here and caused even more issues, I deleted python. Hear me out, I had just now tried the other command seen on link 2 for windows, and it said I had to “upgrade my python” to which I did, to some version with an odd number combination, (not exact, but something along the lines of 20.02.000, lots of 2’s and 0’s which confused me, aren’t we in 3.9.1?). But, after “upgrading” I still got the same error messages screenshotted below, I had seen now that we are on 3.9.1 rater than 3.8.5, and just decided starting fresh would be best, oh how dumb I am, now excess of python is ridden about my computer, a quick search and there will be various files that didn’t leave with python and idle, and attempting to delete most of them is even harder, my computer freaking out with things like “The file had been moved, please re-verify the file location” which it hadn’t even told me to do, and it doesn’t help that there are unreal engine files using the name, python. I’m kind of in a state I don’t know what to do now, I suppose my goals would be to get my computer python free and start from the beginning, or at least have it fully updated to recent python without excess files from beforehand, and to also get my bot working,
to any replies that may help, a large thanks in advance, hopefully we can get this solved,
and sorry if my dumb choices made this harder

Link 1
Link 2

Photo 1 would go here, but it won’t allow me, so do know my code is exact to that of link 1,

Program Code But It's Bad

edit 1: I have found a way to remove all python related files, by using the app manager I could remove the launcher, but not the python 3.8.5 itself, as I deleted the files for it but not the app, it was unable, luckily I found out how , that by using another manager I deleted the empty shell left behind, now the main problem is, “How do I get my bot working? Where do I start?”

Hi Brady, and welcome!

There’s a lot to digest in your post, but here goes:

  • Don’t panic, stay calm and be precise.

  • Break your text up into paragraphs, it’s hard for us to read a wall of text.

  • Focus on the problem you want us to solve, not your life story: you
    seem to have Python working again, so the fact that you deleted it and
    then reinstalled it probably is irrelevant. Likewise the fact its a
    refurbished computer.

Let’s start with the basics:

  • Can you run Python?

  • Can you import the “discord” library?

If you can do both of those things, then you probably (99% sure) have a
working Python interpreter with the discord library.

Can you go through the normal steps you would take to start up Python?
Get to the point that you can type some code at the “>>>” prompt and run
these lines of code:

import sys
import discord
print(sys.version, discord)

Copy and paste any output. Please don’t send a photo, screenshot or
other image, I won’t see it.

You said:

“my code is exact to that of link 1”

Double check and then triple check that it is precisely the same.
Especially look for missing brackets or parentheses, missing or extra
commas, underscores and dots, and indentation that is different.

It might help to step away and work on something else for a while, so
you come back with fresh eyes.

Once you are absolutely sure you have the same code, try running it
again. Has the error gone away? If not, then please copy and paste the
traceback here as text.

Consider that it is possible that the error is not yours, but the
tutorial’s. I see people have commented on the tutorial page, reporting
a number of errors. One mentions the error:

File “”, line 22, in on_message
 await client.send_message(, “World”)
AttributeError: ‘Client’ object has no attribute ‘send_message

but the Client object doesn’t seem to have a send_message method:

so it could be that the tutorial is buggy, or obsolete.

Heya Steve, thanks for the reply!

I had a question or two and a few things I wanted to address from the reply, as I actually have not gotten python running and have a question with that. But I’m going to address things in order from your response and paragraph contained so here goes:

I guess to hop right in on something I had wanted to address, I thought to mention reinstalling python and the refurb as, like I had said, I am an amateur programmer and very new to python, I’m not 100% sure on what exactly could be causing issues, so I made sure to bring the possibilities up, apologies if it seemed a little much, but I tried to address issue possibility and trouble shoot.

Leading from that to one of the other things I wanted to address, python reinstallation. I hadn’t gotten around to doing so yesterday, as I was rather busy, but as of my first time reading your response I immediately began the process. Alas, as in reinstalling it, I have noticed (what appears to be) a new option checkbox on adding python 3.9 to PATH, of which I’m unsure if I should check off this box or not. Some short research hasn’t found much, and I am rather curious if this would have to do with the issues or not, or possibly be something I should consider checking.

In advance apologies on being a bit behind on the process from your reply, I have read it in it’s entirety a few times and once I have python reinstalled, will begin testing the possible solutions you have given. But in advance to solving that, I had a clarifying question so problems don’t occur in the future:

I don’t exactly remember a prompt such as this, but it is likely faulty memory, (if so my bad) and the fact I have heard most people installing the discord library through the computer’s command prompt, so where exactly do I test these lines of code? (again, apologies, it seems like a rather obvious answer that I’m not seeing, thank you for being patient with me)

Other than that thank you on the response, hopefully we can get this solved.

Hi Brady,

How would you start up Python? What button, command or icon would you

click or type?

What happens when you do that? If possible, please try to copy and paste

the actual text of the error message, if any.

If you go to the Start Menu and type “Python”, does it show a Python

menu command? Can you click on that?

It should open a console window running the Python interpreter. If you

get that far, it should have a prompt “>>>”.

Hi Steve!
Here is a quick update
First and foremost, I sincerely apologize on the many deleted replies, I have had many issues with python over the last months but they are solved now. Secondly, I think you misunderstood, I was trying to find out a python reinstallation option, there was nothing wrong with python itself, but the good news is it’s been reinstalled after I asked here.

The reason I outsourced this help is you sort of disappeared for a time, hence why many of my replies were deleted and I tried to grab that help elsewhere, I apologize if I had any influence of the disappearing, and I hope I have not done anything to cause it either, I appreciate your help and will be testing your recommendations soon, so expect another reply following this one soon enough
Thank you for all the help, more replies to follow,
Brady Brecht

Alright so I have finally attempted,

I opened python, went to the >>> prompt, and tried all 3 lines, here is what I got for each:

>>> import sys
>>> import discord
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'discord'
>>> print(sys.version, discord)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'discord' is not defined

After this I had tried the bot, still not working.

Hi Brady,

You need to fix this before you can get started on your Discord bot:

ModuleNotFoundError: No module named 'discord'

Have you installed the discord module? It doesn’t come standard with
Python, you have to install it first. Until you install it, nothing else
you do will fix the problem.

I’ve never heard of this module, where are you getting this bot
script from?

You then said:

“After this I had tried the bot, still not working.”

“It’s not working” is the most useless description of a programming
problem, even worse than “an error occurred” :slight_smile:

What does “not working” mean?

In your case, I can guess that “not working” means that you get the
ModuleNotFoundError seen above, but if I didn’t already know that, “not
working” could mean a million different things from:

  • the bot runs, but doesn’t do what you expect

all the way to:

  • when you try to run the bot, your computer caught fire.

So for future reference, please try to be more specific:

  • what did you do?
  • what did you expect to happen?
  • what actually happened?

Once again, big apologies, and thank you for being patient with me, I’ll keep that in mind for my next responses, but for now I shall respond to both points:

Subject 1

Once again apologies for not specifying, it was the same error from the very first post here, and I believe it was because I hadn’t had the discord module fully installed, which I am now trying to do.
As for what I was hoping the bot to do, was respond with the given responses to the given messages, yet the original error message still pops up, and it does not respond, I am now working on getting the module installed so it may work, and that brings me to the next point:
Subject 2

I believe much earlier I had mentioned I had installed the discord module after many attempts of false commands, and I now realize I had not reinstalled it along with python, so as of typing this I am reusing the same line in command prompt, but an interesting message has reoccured, remember I had said:

and now, I actually have the line for this, it states:

WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
You should consider upgrading via the 'C:\Users\brady\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command.

I guess I have an incredibly large question, is this something I should do?

Once that is all solved and the module has been installed, I will continue testing with your advice, I don’t think I can say this enough, but once again, Thanks Steve!

I do, if only to shut up pip.

In normal use for most people, particular people new to Python, it won’t
be important either way. It happens that right now pip is getting some
significant internal changes to the way it resolves dependencies (when
you install module X, that module requires module Y, sometimes with a
particular version requirement - pip does this stuff for you).

But also, if bugs get found and fixed, those fixes will be in the newer
version :slight_smile:

Cameron Simpson

Hey @steven.daprano, I’m back, sorry on the long wait.
But yeah, I have done the tests you recommended in your original reply.

I ran these lines in Python, this is what I got

>>> import sys
>>> import discord
>>> print(sys.version, discord)
3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] <module 'discord' from 'C:\\Users\\brady\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\discord\\'>

I sent the “Hello” Message into discord.

And Afterward:
I received the following error message in the IDLE shell.

Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\brady\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\brady\OneDrive\Desktop\Projects\Possibly", line 11, in on_message
    await client.send_message(, "Hello")
AttributeError: 'Client' object has no attribute 'send_message'

I am unsure of what all I can do now, you may have been right that the tutorial was incorrect, but hopefully we can solve it if possible, what should I do now?

Once again, thanks steve,

Unimportant Note:


I name the program this, as a friend of mine wanted to call it Beverly as a joke, and the “possibly” is due to the fact that I may switch from using the undesirable system (commands) I have now to running events.

I actually just solved the problem, rather fast,
I found a new system and things should be all good now,
I appreciate both your help