这个问题是关于asyncpg和postgres SQL的。用户正在使用命令项目棒球棒。尝试从数据库检索项目时,除非我在引号周围加上引号,例如:!item“ baseball bat”
,否则它将不会接受全名棒球棍。我的最终比赛是:!没有引号的棒球棒。
以下命令:
self.bot.pg_con.fetchrow(“ SELECT item_id FROM项,其中LOWER(name)= $ 1”,名称)
user = await self.bot.pg_con.fetchrow("SELECT item_id FROM item where LOWER(name)= $1 ", name)
user_str = str(user[0])
name = dict['items'][user_str]['name']
print(name)
weapon = dict['items'][user_str]['type']
description = dict['items'][user_str]['description']
market = dict['items'][user_str]['market_value']
buy = dict['items'][user_str]['buy_price']
sell = dict['items'][user_str]['sell_price']
#image = dict['items'][user_str]['image']
embed = discord.Embed(title=f"{name}", description=f"{description}", colour=discord.Color.dark_blue())
embed.set_footer(text=ctx.author.name, icon_url=ctx.author.avatar_url)
embed.add_field(name="Type", value="{}".format(weapon), inline=False)
embed.add_field(name="Market Value", value=f"$""{}".format(market), inline=True)
embed.add_field(name="Torn Buy Price", value=f"$""{}".format(buy), inline=True)
embed.add_field(name="Torn Sell Price", value=f"$""{}".format(sell), inline=True)
#embed.add_field(name="Age", value="{}".format(), inline=False)
await ctx.send(embed=embed)