Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem Discord Bot Python
#1
Hello guys I'm trying to create a Discord bot, using python language, I recently started studying this language so I'm asking for help in this forum.
I downloaded it as a PyCharm editor that also has a built-in compiler that can run the program like the Dev c, the only thing I encountered a couple of problems.

Even if I correctly install the library of discord.py give me these errors, I do not know if I did something wrong in the source code, or it is a problem of the version of the library or python, I wonder if you can a hand from more experts thank you very much.

P.S: Forgive me for my bad English, but I don't speak English at a higher level, being of Italian origin.


This is the source code

import discord

from discord.ext import commands


client = commands.bot(commands_prefix = '$')

TOKEN = 'MY TOKEN'

client = discord.Client()

@client.event
async def on_ready():
    print("Il bot e' pronto!")
    await client.change_presence(game=discord.Game(name="Gioca a Magic Lantern"))

    if message.content.startswith('$ciao'):
        msg = 'Ciao {0.author.mention}'.format(message)
        await client.send_message(message.channel, msg)

@client.event
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')

client.run(TOKEN)
This is the error:

[Image: dOA4tOs.png]
Reply
#2
see https://bugs.python.org/issue34691
it looks like you need to reinstall your python 3.7 It was a bug and resolved. Did you compile python from source?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
You compile it directly from the PyCharm code, but it gives me those errors from how you can want to see.

But anyway I had already tried yesterday to reinstall the python version, but still that error was, so I do not know maybe if the error was solved only recently, at most I can try again.
Reply
#4
By the way, the channel object how now a send method: https://discordpy.readthedocs.io/en/late...g-messages
But this is not the issue. Delete also your venv and look if accidentally a package named contextvars was installed.
I had this issue with enum from pip. The newer built-in library from Python supports more, as the replacement for older versions did.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#5
(Aug-11-2019, 03:50 PM)DeaD_EyE Wrote: By the way, the channel object how now a send method: https://discordpy.readthedocs.io/en/late...g-messages But this is not the issue. Delete also your venv and look if accidentally a package named contextvars was installed. I had this issue with enum from pip. The newer built-in library from Python supports more, as the replacement for older versions did.

This link is not available: https://discordpy.readthedocs.io/en/late...g-messages
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help discord bot Edward 0 2,095 Sep-15-2022, 09:55 PM
Last Post: Edward
  Trying to make a bot to connect on discord with Selenium Python johnsmith43 2 49,081 Mar-21-2022, 02:56 PM
Last Post: Cloudytechnical
  Discord Bot Dark_Sovereign_193 0 35,559 Jun-03-2021, 03:24 PM
Last Post: Dark_Sovereign_193
  Discord Bot Help Oshadha 0 1,397 Jan-26-2021, 04:23 PM
Last Post: Oshadha
  Creating Discord Bot: Unused import statement 'import discord EyeballCandy 0 3,536 Feb-02-2020, 10:53 PM
Last Post: EyeballCandy
  Discord bot problem EdwinAlador 2 61,012 Jul-02-2018, 05:29 PM
Last Post: snippsat
  Discord Bot Arbys 7 30,227 Nov-06-2017, 03:36 PM
Last Post: Gamer
  discord bot lolteam 1 6,065 Aug-31-2017, 08:57 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020