Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async send (
messageList: builder.IMessage[],
done: (
err: Error,
addresses?: builder.IAddress[],
) => void,
): Promise {
const addresses: any[] = []
for (let idx = 0; idx < messageList.length; idx++) {
const msg = messageList[idx]
try {
const wechatyContact = Contact.load(msg.address.user.id)
await wechatyContact.ready()
if (msg.type === 'delay') {
await new Promise(r => setTimeout(r, (msg as any).value))
} else if (msg.type === 'message') {
if (msg.text) {
await wechatyContact.say(msg.text)
}
if (msg.attachments && msg.attachments.length > 0) {
// for (const attachment of msg.attachments) {
// renderAttachment(attachment)
// }
}
addresses.push({
...msg.address,
id: idx,