grammy-mail
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -6,2 +6,3 @@ import { Context } from 'grammy'; | ||
messageSender?: (userId: number) => Promise<any> | any; | ||
filter?: (userId: number) => Promise<boolean> | boolean; | ||
onSend?: (userId: number, isSuccess: boolean) => Promise<any> | any; | ||
@@ -8,0 +9,0 @@ onEnd?: (success: number, failed: number) => Promise<any> | any; |
@@ -36,2 +36,12 @@ "use strict"; | ||
yield Promise.all(part.map((userId) => __awaiter(this, void 0, void 0, function* () { | ||
if (!!params.filter) { | ||
try { | ||
if (!(yield params.filter(userId))) | ||
return; | ||
} | ||
catch (_a) { | ||
if (!params.filter(userId)) | ||
return; | ||
} | ||
} | ||
let isSuccess = true; | ||
@@ -52,3 +62,3 @@ if (params.messageSender) { | ||
} | ||
catch (_a) { | ||
catch (_b) { | ||
params.onSend(userId, isSuccess); | ||
@@ -55,0 +65,0 @@ } |
{ | ||
"name": "grammy-mail", | ||
"description": "Send your mails to users in the grammY framework", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
7659
86