Do not let me import the discord library from python

0

I'm trying to make a discord bot and I'm not sure about the import of the first line, I do not know why.

import discord
from discord.ext import commands
from discord.ext.commands import Bot

Cliente = discord.Client()
cliente = commands.Bot("!")

#Ping al bot
@discord.client.event
async def on_message(message):
    if message.content.startswith('!Hi'):
        await discord.client.send_message(message)
    pass
cliente.run('NTA3Njc5Nzc2OTc1MzU1OTI3.Dr2rZA.Kt5qjj7kBKundrrjDy8pGP_Tsmg')

And I get this error:

/usr/bin/python3 /home/mario/PycharmProjects/Bot/Main.py
Traceback (most recent call last):
  File "/home/mario/PycharmProjects/Bot/Main.py", line 1, in <module>
    import discord
  File "/usr/lib/python3.7/site-packages/discord/__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "/usr/lib/python3.7/site-packages/discord/client.py", line 38, in <module>
    from .state import ConnectionState
  File "/usr/lib/python3.7/site-packages/discord/state.py", line 36, in <module>
    from . import utils, compat
  File "/usr/lib/python3.7/site-packages/discord/compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax

I have read that sometimes going to the previous version of python was solved, I have done it and it has not worked for me. Thanks for the help

    
asked by Mariopenguin 02.11.2018 в 13:54
source

1 answer

0

This library does not support 3.7. This particular error is due to async becoming a reserved keyword. Try updating the library.

Reference

    
answered by 02.11.2018 в 14:57