Python Forum

Full Version: Problem Discord Bot Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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]
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?
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.
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.
(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