有线无效语法Discord Bot

时间:2017-11-03 21:53:48

标签: python

我开始写一个不和谐的机器人,它工作了好几次,我只添加了!random命令。 现在我收到了一个错误。 这是我的代码:

import discord
import asyncio
import random
import time

client = discord.Client()

@client.event
async def on_ready():
    print("---------------------")
    print("Eingelogt als")
    print(client.user.name)
    print(client.user.id)
    print("---------------------")

@client.event
async def on_message(message):
    if message.content.lower().startswith("!test"):
        await client.send_message(message.channel, "Test bestanden")

    if message.content.lower().startswith("!münze"):
        choice = random.randint(1,2)
        if choice == 1:
            await client.add_reaction(message, "")
        elif choice == 2:
            await client.add_reaction(message, "")

    if message.content.lower().startswith("!random"):
        await client.send_message(message.channel, random.randint(0,100)



client.run('right token checked multipe times')

这是错误:

  File "C:/Users/Woodpecker/Desktop/1010/Python/Reddit_Bot/Woodpecker´s secretary.py", line 33
    client.run('token')
         ^
SyntaxError: invalid syntax

1 个答案:

答案 0 :(得分:1)

await client.send_message(message.channel, random.randint(0,100)

您需要添加额外的)

await client.send_message(message.channel, random.randint(0,100))