【发布时间】:2021-09-04 11:01:17
【问题描述】:
我尝试在 discord.py 中创建一个楼梯命令,它应该是这样的:
---
I
----
I
等等……
但我得到一个错误:
SyntaxError: 无效语法 PS E:\Hyper Bot> & C:/Users/merli/AppData/Local/Programs/Python/Python36-32/python.exe "e:/Hyper Bot/Hyper bot.py" 文件“e:/Hyper Bot/Hyper bot.py”,第 183 行 时间.睡眠 1 ^ SyntaxError: 无效语法
这是我的代码:
async def stairs(ctx):
i = 1
while True:
ctx.send(i * '-')
ctx.send(i * ' ' + 'I')
i = i + 2
time.sleep 1 ```
【问题讨论】:
-
time.sleep(1)你缺少括号。 -
你在
ctx.send之前缺少await。
标签: python discord command discord.py bots