每次我运行discord命令时,都会显示此信息

时间:2019-03-31 04:04:33

标签: python

========= RESTART: C:/Users/Joseph/Desktop/DiscordBots/welcomebot.py =========
Traceback (most recent call last):
  File "C:/Users/Joseph/Desktop/DiscordBots/welcomebot.py", line 4, in <module>
    import discord
  File "C:\Users\Joseph\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "C:\Users\Joseph\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 38, in <module>
    from .state import ConnectionState
  File "C:\Users\Joseph\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\state.py", line 36, in <module>
    from . import utils, compat
  File "C:\Users\Joseph\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax
>>> 

我尝试过重新键入代码,而香港专业教育学院尝试键入一个全新的代码,但我一直得到相同的结果。

# welcomebot

# import all necessary commands and libraries
import discord
import asyncio

client = discord.client()

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

client.run('id')`enter code here`

当您运行脚本时,应该说是作为“欢迎”机器人登录,而不是错误消息

0 个答案:

没有答案