@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.cjs +12 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/server/index.js +13 -7
package/dist/index.cjs
CHANGED
|
@@ -2689,11 +2689,15 @@ function mapTelegramError(error, fallbackMessage) {
|
|
|
2689
2689
|
if (error instanceof DomainError) return error;
|
|
2690
2690
|
if (isTelegramRpcError(error)) {
|
|
2691
2691
|
const msg = error.errorMessage ?? "";
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2692
|
+
const seconds = error.seconds;
|
|
2693
|
+
const floodSeconds = typeof seconds === "number" ? seconds : msg.startsWith("FLOOD_WAIT_") ? Number(msg.slice("FLOOD_WAIT_".length)) : null;
|
|
2694
|
+
if (msg.startsWith("FLOOD") && floodSeconds !== null && floodSeconds > 0) {
|
|
2695
|
+
return new RateLimitedError(
|
|
2696
|
+
`Telegram rate limit reached \u2014 retry in ${floodSeconds} seconds`,
|
|
2697
|
+
{
|
|
2698
|
+
retryAfterSeconds: floodSeconds
|
|
2699
|
+
}
|
|
2700
|
+
);
|
|
2697
2701
|
}
|
|
2698
2702
|
switch (msg) {
|
|
2699
2703
|
case "PHONE_NUMBER_INVALID":
|
|
@@ -3127,7 +3131,9 @@ var TelegramStorageProvider = class {
|
|
|
3127
3131
|
try {
|
|
3128
3132
|
await this.client.deleteMessages(this.peer, [Number(ref.messageId)], { revoke: true });
|
|
3129
3133
|
} catch (error) {
|
|
3130
|
-
|
|
3134
|
+
const mapped = mapTelegramError(error, "Telegram delete failed");
|
|
3135
|
+
if (mapped instanceof TelegramFileNotFoundError) return;
|
|
3136
|
+
throw mapped;
|
|
3131
3137
|
}
|
|
3132
3138
|
}
|
|
3133
3139
|
async exists(ref) {
|