简单的问题:我有一段代码,根据我所知,它应该会向我发送一条关于不和谐的消息,但它没有,我也没有收到错误,它只是没有做任何事情。它也不会停止,只是继续无处可去。代码如下所示:
@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不是问题所在
有什么想法吗
我想你忘了给你的命令加前缀:
您可以用其他内容替换
.
还可以尝试用
@client.command()
替换@bot.command
像这样:
相关问题 更多 >
编程相关推荐