i
Size: a a a
i
r
r
r
I
r
KL
const limit = pLimit(5)
await User.find({ sent: true }).cursor()
.eachAsync((user) => limit(() => sendHoroscope(bot, user))
I
const limit = pLimit(5)
await User.find({ sent: true }).cursor()
.eachAsync((user) => limit(() => sendHoroscope(bot, user))
OS
const limit = pLimit(5)
await User.find({ sent: true }).cursor()
.eachAsync((user) => limit(() => sendHoroscope(bot, user))
OS
KL
KL
I
KL
АТ
KL
OS
OS
import util from 'util';
import { Markup as m} from 'telegraf';
import bot from '../app';
const delay = util.promisify(setTimeout);
async function task() {
const { telegram: tg } = bot;
const { api } = bot.context;
const query = { status: 1 };
const clients = api.service('clients').find({query});
for await (const client of clients) {
const keyboard = m.inlineKeyboard([]).extra();
await tg.sendMessage(client.chatId, '...', keyboard);
await delay(250);
}
}
task();
АТ