-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
短时间内多次调用room.say(message),只发送了最后一次,怎么解决呢?message的内容是不同的。 #2673
Comments
为了解决短时间内多次调用 以下是一个实现示例: async function sendMessagesSequentially(room, messages, delay) {
for (const message of messages) {
await room.say(message);
await new Promise(resolve => setTimeout(resolve, delay));
}
}
// 使用示例
const messages = ['Message 1', 'Message 2', 'Message 3']; // 要发送的消息数组
const delay = 1000; // 每条消息之间的延迟时间,单位毫秒
sendMessagesSequentially(room, messages, delay); 这段代码会按照您指定的延迟时间,逐一发送每条消息。通过这种方式,您可以有效避免因快速连续调用 Sources
|
如题,有解决方案吗?
我这边会bot监听群里的信息,当匹配特殊字段信息就返回一段对于的内容。希望支持批量处理,比如批量发送多条信息到群里,bot能全返回。
The text was updated successfully, but these errors were encountered: