为不和谐的机器人编写.py逻辑,但无法运行,我是否缺少某些东西?

时间:2018-10-17 16:56:53

标签: pycharm python-3.5 discord.py discord.py-rewrite

import discord

TOKEN = 'insert bot token here'

client = discord.Client()

@client.event
async def on_message(message):
    # we do not want the bot to reply to itself
    if message.author == client.user:
        return

    if message.content.startswith('sam'):
        msg = 'what {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)

这就是我尝试运行它时发生的事情。

Image1

我正在使用Python 3.5,Pycharm,pip 18.1,virtualenv和最新版本的discord。我将该机器人作为应用程序,并且正确地复制了令牌。

Image2

0 个答案:

没有答案