@lacrous/omnicloud 0.2.21 → 0.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2626,11 +2626,15 @@ function mapTelegramError(error, fallbackMessage) {
2626
2626
  if (error instanceof DomainError) return error;
2627
2627
  if (isTelegramRpcError(error)) {
2628
2628
  const msg = error.errorMessage ?? "";
2629
- if (msg.startsWith("FLOOD_WAIT_")) {
2630
- const seconds = Number(msg.slice("FLOOD_WAIT_".length)) || 60;
2631
- return new RateLimitedError(`Telegram rate limit reached \u2014 retry in ${seconds} seconds`, {
2632
- retryAfterSeconds: seconds
2633
- });
2629
+ const seconds = error.seconds;
2630
+ const floodSeconds = typeof seconds === "number" ? seconds : msg.startsWith("FLOOD_WAIT_") ? Number(msg.slice("FLOOD_WAIT_".length)) : null;
2631
+ if (msg.startsWith("FLOOD") && floodSeconds !== null && floodSeconds > 0) {
2632
+ return new RateLimitedError(
2633
+ `Telegram rate limit reached \u2014 retry in ${floodSeconds} seconds`,
2634
+ {
2635
+ retryAfterSeconds: floodSeconds
2636
+ }
2637
+ );
2634
2638
  }
2635
2639
  switch (msg) {
2636
2640
  case "PHONE_NUMBER_INVALID":
@@ -3064,7 +3068,9 @@ var TelegramStorageProvider = class {
3064
3068
  try {
3065
3069
  await this.client.deleteMessages(this.peer, [Number(ref.messageId)], { revoke: true });
3066
3070
  } catch (error) {
3067
- throw mapTelegramError(error, "Telegram delete failed");
3071
+ const mapped = mapTelegramError(error, "Telegram delete failed");
3072
+ if (mapped instanceof TelegramFileNotFoundError) return;
3073
+ throw mapped;
3068
3074
  }
3069
3075
  }
3070
3076
  async exists(ref) {