【发布时间】:2021-05-05 02:12:48
【问题描述】:
我创建了一个与 mysql 数据库交互的不和谐机器人,但是当您运行使用 UPDATE 查询的命令时,它不会执行更新查询而是执行 sleep ,这意味着数据库中的数据没有被更改。
(来自评论)
@client.command()
async def SetJob(ctx, uid: str, rank: str):
disout = exec("UPDATE users SET 'job'='{0}' WHERE identifier='{1}'".format(rank,uid))
if ctx.message.author == client.user:
return
if ctx.message.author.id not in whitelisted:
await ctx.send(embed=discord.Embed(title="You are not authorized to use this bot", description='Please contact Not Soviet Bear to add you to the whitelisted members list', color=discord.Color.red()))
return
else:
await ctx.send(embed=discord.Embed(title="Job Change", description="Job changed to '{0}' for Identifier'{1}'".format(rank,uid), color=discord.Color.blue()))
【问题讨论】:
-
请edit您的问题更详细地解释。 MySQL 不太可能用 SLEEP 代替 UPDATE 命令。请出示相关代码,以便我们为您提供帮助。
-
这是有问题的代码,我不得不将它链接到粘贴箱,因为它太长了,无法添加到评论pastebin.com/b4hUNSJq至于编辑问题,这是我能解释的最好的因为我不知道是什么导致了问题
标签: mysql python-3.x discord.py