Python 打印discord.py语法错误,但我可以';我不明白这个问题
我正在编写一个discord机器人,但它在一个简单的打印命令上给了我一个错误,我不明白为什么Python 打印discord.py语法错误,但我可以';我不明白这个问题,python,discord.py,Python,Discord.py,我正在编写一个discord机器人,但它在一个简单的打印命令上给了我一个错误,我不明白为什么 #iports the discord folder and commands for our bot import discord from discord.ext import commands from discord import Member from discord.ext.commands import has_permissions from discord.ext import tas
#iports the discord folder and commands for our bot
import discord
from discord.ext import commands
from discord import Member
from discord.ext.commands import has_permissions
from discord.ext import tasks
#defining veriables
#water_reminder_members = []
#sets the command prefix
Client = commands.Bot(command_prefix = "!")
#print Nuggie is ready in the console when the bot is activeted
@Client.event
async def on_ready():
await Client.change_presence(status=discord.Status.online))
print("Bot is ready")
@Client.command()
async def list(ctx):
nNum = len(codes)
codesStr = await client.wait_for('message', check=check(context.author), timeout=30
print(codesStr)
#bot's client code
Client.run('my_token')
我得到的错误是:
print(codesStr)
^
SyntaxError: invalid syntax
有人知道为什么吗?这行末尾没有)
codesStr = await client.wait_for('message', check=check(context.author), timeout=30
还有一个)
await Client.change_presence(status=discord.Status.online))
您应该删除其中一个括号。行末没有)
codesStr = await client.wait_for('message', check=check(context.author), timeout=30
还有一个)
await Client.change_presence(status=discord.Status.online))
您应该删除其中一个括号。代码中实际上还有另一个不匹配的括号。你可以抓住这些无与伦比的帕伦斯和更多!用薄片8。执行
pip安装flake8
,然后执行flake8 discord.py
以在运行代码之前捕获语法错误。实际上,代码中还有另一个不匹配的参数。你可以抓住这些无与伦比的帕伦斯和更多!用薄片8。执行pip安装flake8
,然后执行flake8 discord.py
以在运行代码之前捕获语法错误。