【发布时间】:2020-12-21 07:52:20
【问题描述】:
简单的问题:我有这个代码块,它应该根据我所知道的向我发送一条关于不和谐的消息,但它没有,我也没有收到错误,它只是没有做任何事情。它也没有停止,只是继续跑到无处。代码如下所示:
@bot.command
async def steamfetch(ctx):
await ctx.send("hi there")
if Float <= 0.05:
print('in bracket')
element2 = driver.find_element_by_xpath('/html/body/div[1]/div[7]/div[2]/div[2]/div[4]/div[1]/div[3]/div[4]/div[4]/div[2]/div[2]/div[2]/span/span[1]')
Price = element2.text
print('ready to send')
await ctx.send(f"Snipe found:\nMag-7 Carbon Fiber Factory New with Float:\n{Float}\n{Price}")
bot.run('Token')
但是,第一条消息和第二条消息都不做任何事情。该变量肯定小于 0.05,但第一个打印也没有进来。我也尝试过不使用 if 函数,但这也不起作用。我上面有一个async def on_ready: 函数,它有效,所以我认为机器人不是问题
有什么想法吗?
【问题讨论】:
-
只是
@bot.command()而不是@bot.command
标签: python python-3.x discord.py