https://media.discordapp.net/attachments/977648291770667010/977648292206903336/unknown.png
正如您在屏幕截图中所看到的,有一个关于在官方PyCord网站超时到期时如何编辑消息内容的解释。
但正如你在这张截图中所看到的:https://media.discordapp.net/attachments/977648291770667010/977648292655677440/unknown.png
PyCharm说没有所谓的“消息”字段。
调试时会出现相同的错误:
这是我的代码:
class UIAgreement(View):
def __init__(self, client: Stragate):
super().__init__(timeout=10)
self.client = client
async def on_timeout(self):
self.disable_all_items()
await self.message.edit(content="You took too long! Try again.", view=self)
@button(label="Accept", style=ButtonStyle.success, emoji="")
async def accept_callback(self, event_button: Button, event_interaction: Interaction):
cursor = self.client.database.cursor()
cursor.execute(f"SELECT * FROM profiles WHERE id={event_interaction.user.id} LIMIT 1")
if not cursor.fetchone():
cursor = self.client.database.cursor()
cursor.execute("INSERT INTO profiles (id, full_name, job, country, description, thumbnail, "
"gender) VALUES (%s, %s, DEFAULT, DEFAULT, DEFAULT, %s, DEFAULT)",
(
event_interaction.user.id,
event_interaction.user.display_name,
"https://media.discordapp.net/attachments/976061052548694036"
"/977291014047936552/default.jpg"
))
self.client.database.commit()
await event_interaction.user.send(embed=Embed(
title="Successfully registered!",
description="Please use the 'start' command again."
))```
[1]: https://i.stack.imgur.com/ymKyQ.png发布于 2022-05-21 19:42:37
我学到了"Message“字段,这是我需要在范围之外设置的字段。他们在不和谐的服务器上就是这么说的。我想指南有点过时了。
https://stackoverflow.com/questions/72332598
复制相似问题