我有此代码:
async def on_guild_channel_update(before, after):
channel = discord.utils.get(before.guild.channels, name="bot-logs")
embed=discord.Embed(title="Channel Name Updated", description="A channel name was updated.")
embed.add_field(name="Old name", value=f"The old name was: {before}.", inline=True)
embed.add_field(name="New name", value=f"The old name was: {after}.", inline=False)
await channel.send(embed=embed)
其他人说它应该可以正常工作,但是有人知道为什么这对我不起作用吗?
答案 0 :(得分:1)
如评论中所述,您拥有python 3.5,3.6中引入了f字符串。要进行升级,请转到python.org并下载python 3.6+的版本(建议使用3.8.3)。然后运行它,因为已经安装了python,可以单击“立即升级”按钮,它将安装在您的计算机上。希望您有Windows,但我不知道它是否可以在Mac / Linux中工作