无法通过Pycord发送短暂的(“ hidden&quot”)消息
根据其他答案,以下代码应发送短暂消息:等待ctx.send('消息发送✅',ephemeral = true)
但是,在运行代码时,我会收到此错误:
Ignoring exception in command message:
Traceback (most recent call last):
File "/home/runner/bot/venv/lib/python3.8/site-packages/discord/commands/core.py", line 126, in wrapped
ret = await coro(arg)
File "/home/runner/bot/venv/lib/python3.8/site-packages/discord/commands/core.py", line 860, in _invoke
await self.callback(ctx, **kwargs)
File "main.py", line 39, in _slash
await ctx.send('Message Sent ✅', ephemeral=True)
TypeError: send() got an unexpected keyword argument 'ephemeral'
此代码似乎对其他人有用,所以我不确定我在做什么错。
Python版本:3.8
Pycord版本:开发(今天早上直接从开发分支机构安装)
According to other answers the following code should send an ephemeral message:await ctx.send('Message Sent ✅', ephemeral=True)
But when running the code, I get this error:
Ignoring exception in command message:
Traceback (most recent call last):
File "/home/runner/bot/venv/lib/python3.8/site-packages/discord/commands/core.py", line 126, in wrapped
ret = await coro(arg)
File "/home/runner/bot/venv/lib/python3.8/site-packages/discord/commands/core.py", line 860, in _invoke
await self.callback(ctx, **kwargs)
File "main.py", line 39, in _slash
await ctx.send('Message Sent ✅', ephemeral=True)
TypeError: send() got an unexpected keyword argument 'ephemeral'
This code seems to work for other people, so I'm not sure what I'm doing wrong.
Python Version: 3.8
Pycord Version: Development (installed directly from dev branch this morning)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Discord使用“响应”来响应命令,然后“发送”将消息发送到特定的频道。只有响应才能是短暂的,因此您应该使用
重要的事情来理解,您需要进行互动来发出信息短暂的信息,因为没有一个人,该消息将是短暂的?这就是为什么它仅用于响应互动的原因。
Discord uses 'respond' to respond to commands and 'send' to send a message to a specific channel. Only responses can be ephemeral so you should use
The important thing to understand is that you need an interaction to make a message ephemeral because without one, who would the message be ephemeral to? That‘s why it only works for responses to interactions.