从频道获取一系列消息

Get a range of messages from a channel

我试图让用户在键入 !done 之前向机器人提交一堆信息,并让机器人转发 init 消息和 !done 消息之间的所有消息。换句话说,用户的消息日志可能如下所示:

!init
MessageA
MessageB
MessageC
!done

我想提取 !init 和 !done 之间的所有消息,假设我已经将它们的 ID 存储在 messageInitID 和 messageDoneID 中。不知道有多少留言。

我试过.fetchMessages([options]) but the [options]只允许某条消息之前的消息,某条消息之后的消息,以及某条消息周围的消息。

有没有什么办法可以在一个频道里按时间顺序接收所有的消息?还是 ID 已经设计为按时间顺序排列?

编辑:我想我可以使用 MessageCollector,并且只提取日期在 !init 日期之后和 !done 日期之前的消息,但这看起来效率很低,因为它会检查已经进入的每条消息DM

Or are IDs already designed to be in chronological order?

ID 的数据类型是 "Snowflake",定义为 A Twitter snowflake, except the epoch is 2015-01-01T00:00:00.000Z (doc) 所以是的,如果一个 ID 比另一个大,则稍后发送时间.

I've tried .fetchMessages([options]) but the [options] only allows for messages before a certain message, messages after a certain message, and messages around a certain message.

但是您可以检索 !done 消息之前的消息,并过滤 !init 之后发送的消息。