MCPcopy Index your code
hub / github.com/CopilotKit/OpenTag / drainUpdates

Function drainUpdates

e2e/telegram-api.ts:184–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182 * `offset > drainFence` after this call.
183 */
184export async function drainUpdates(): Promise<number> {
185 let highestUpdateId = -1;
186 // Keep fetching until we get an empty page (queue exhausted).
187 for (;;) {
188 const updates = await getUpdates(highestUpdateId + 1, 100);
189 if (updates.length === 0) break;
190 for (const u of updates) {
191 if (u.update_id > highestUpdateId) highestUpdateId = u.update_id;
192 }
193 }
194 return highestUpdateId;
195}
196
197/**
198 * Poll the bot's updates for a message FROM THE BOT in `chatId` after

Callers 1

runCaseFunction · 0.85

Calls 1

getUpdatesFunction · 0.85

Tested by

no test coverage detected