在 Discord 中,有没有办法在 Message/MessageEmbed 中添加一些自定义元数据?

发布于 2025-01-13 12:01:03 字数 244 浏览 3 评论 0原文

我有一个机器人,它可以用组件生成消息。绑定到组件的操作取决于特定于消息的数据,因此是我的问题。

可以从消息内容中解析数据,但我想避免此操作(出于您可以想象的原因)。最简单的方法是将所有内容存储在某种字典中(消息 id => 想要的数据),但我的应用程序是无状态的。

我可以使用外部数据库,但我不想走那么远。我可以使用 customId 属性。它很脏,但适用于小数据。我可以使用其他财产,但哪一个呢?

欢迎任何其他解决方案...

I have a bot which produces messages whith components. The actions binded to the components depend on data specific to the message, hence my problem.

The data could be resolved from the message content, but I'd like to avoid this operation (for reasons you can imagine). The simplest way would be to store everything in a sort of dictionary (message id => wanted data), but my app is stateless.

I could use a external database, but I don't want to go that far. I could use the customId property. It's quite dirty, but works for small data. I could use an other property, but which one ?

Any other solutions would be welcome...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文