nexushub-commands 2.7.5 → 2.7.6
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/image.jpg +0 -0
- package/lib/commands/deposit/Deposit.command.js +3 -3
- package/lib/commands/deposit/SendCheque.command.d.ts +1 -0
- package/lib/commands/deposit/SendCheque.command.js +27 -3
- package/lib/test.d.ts +1 -0
- package/lib/test.js +12 -0
- package/load.sh +1 -1
- package/package.json +3 -2
- package/rus.traineddata +0 -0
- package/src/commands/deposit/Deposit.command.ts +27 -30
- package/src/commands/deposit/SendCheque.command.ts +34 -1
- package/src/test.ts +14 -0
package/image.jpg
ADDED
|
Binary file
|
|
@@ -119,8 +119,8 @@ let DepositCommand = DepositCommand_1 = class DepositCommand extends evogram_1.C
|
|
|
119
119
|
from: order.currency,
|
|
120
120
|
to: 'RUB',
|
|
121
121
|
ceiled: true,
|
|
122
|
-
})})`
|
|
123
|
-
:
|
|
122
|
+
})}) [${order.id}]`
|
|
123
|
+
: `[${order.id}]`}`, {
|
|
124
124
|
// prettier-ignore
|
|
125
125
|
message: order.card ?
|
|
126
126
|
`<b>💳 Реквизиты:</b> <code>${maskExceptLast4(order.card.requisites)}</code>\n` +
|
|
@@ -146,7 +146,7 @@ let DepositCommand = DepositCommand_1 = class DepositCommand extends evogram_1.C
|
|
|
146
146
|
if (['paid', 'fakepaid'].includes(neworder.status) || neworder.cheque)
|
|
147
147
|
return;
|
|
148
148
|
const msgInfo = yield context.client.database.config.get(`order${order.id}`);
|
|
149
|
-
if (!msgInfo)
|
|
149
|
+
if (!msgInfo || neworder.cheque)
|
|
150
150
|
return;
|
|
151
151
|
context.client.api.deleteMessage({ chat_id: msgInfo.value.chatId, message_id: msgInfo.value.messageId });
|
|
152
152
|
context.sendFormatted({
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var SendChequeCommand_1;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.SendChequeCommand = void 0;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
7
|
const evogram_1 = require("evogram");
|
|
7
8
|
const migrated_1 = require("evogram/lib/migrated");
|
|
9
|
+
const tesseract_js_1 = require("tesseract.js");
|
|
8
10
|
const Client_1 = require("../../Client");
|
|
9
|
-
|
|
10
|
-
let SendChequeCommand = class SendChequeCommand extends migrated_1.Command {
|
|
11
|
+
let SendChequeCommand = SendChequeCommand_1 = class SendChequeCommand extends migrated_1.Command {
|
|
11
12
|
execute(context, orderId) {
|
|
12
13
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
14
|
const config = Client_1.Client.config(context);
|
|
@@ -34,6 +35,28 @@ let SendChequeCommand = class SendChequeCommand extends migrated_1.Command {
|
|
|
34
35
|
}
|
|
35
36
|
if (!url)
|
|
36
37
|
throw new Error('Пожалуйста, отправьте изображение с квитанцией в следующем сообщении');
|
|
38
|
+
try {
|
|
39
|
+
const worker = yield SendChequeCommand_1.WORKER;
|
|
40
|
+
const { data } = yield worker.recognize(url);
|
|
41
|
+
const noSuccess = !!['Ожидает подтверждения', 'В обработке'].find((x) => data.text.includes(x));
|
|
42
|
+
if (noSuccess) {
|
|
43
|
+
context.sendFormatted({
|
|
44
|
+
designImages: order.method === 'card' ? ['deposit-card', 'deposit'] : order.method === 'cryptoBot' ? ['deposit-crypto-bot', 'deposit-crypto', 'deposit'] : [`deposit-crypto-${order.currency.toLowerCase()}`, 'deposit-crypto-wallet', 'deposit-crypto', 'deposit'],
|
|
45
|
+
photo: config.images.depositCard,
|
|
46
|
+
// prettier-ignore
|
|
47
|
+
header: '<blockquote><b>🧾 Подтверждение оплаты счета</b></blockquote>\n\n' +
|
|
48
|
+
'<i>Система определила, что ваша транзакция на данный момент находится в обработке банка. Пожалуйста, дождитесь подтверждения оплаты и повторите попытку</i>\n\n' +
|
|
49
|
+
'<b>ℹ️ Как только транзакция будет подтверждена, в квитанции появится статус Подтвержден</b>',
|
|
50
|
+
}, {
|
|
51
|
+
reply_markup: {
|
|
52
|
+
inline_keyboard: [[{ text: '🔄 Повторить попытку', command: SendChequeCommand_1, payload: { orderId } }]],
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error(error);
|
|
59
|
+
}
|
|
37
60
|
const photoURL = yield axios_1.default
|
|
38
61
|
.request({
|
|
39
62
|
method: 'POST',
|
|
@@ -68,12 +91,13 @@ let SendChequeCommand = class SendChequeCommand extends migrated_1.Command {
|
|
|
68
91
|
}
|
|
69
92
|
};
|
|
70
93
|
exports.SendChequeCommand = SendChequeCommand;
|
|
94
|
+
SendChequeCommand.WORKER = (0, tesseract_js_1.createWorker)('rus');
|
|
71
95
|
tslib_1.__decorate([
|
|
72
96
|
tslib_1.__param(1, (0, evogram_1.CommandArgument)('orderId')),
|
|
73
97
|
tslib_1.__metadata("design:type", Function),
|
|
74
98
|
tslib_1.__metadata("design:paramtypes", [migrated_1.CommandContext, String]),
|
|
75
99
|
tslib_1.__metadata("design:returntype", Promise)
|
|
76
100
|
], SendChequeCommand.prototype, "execute", null);
|
|
77
|
-
exports.SendChequeCommand = SendChequeCommand = tslib_1.__decorate([
|
|
101
|
+
exports.SendChequeCommand = SendChequeCommand = SendChequeCommand_1 = tslib_1.__decorate([
|
|
78
102
|
(0, evogram_1.CommandD)({ name: 'sendCheque' })
|
|
79
103
|
], SendChequeCommand);
|
package/lib/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/test.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const tesseract_js_1 = require("tesseract.js");
|
|
5
|
+
(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
6
|
+
const worker = yield (0, tesseract_js_1.createWorker)('rus');
|
|
7
|
+
const { data } = yield worker.recognize(process.argv[2]);
|
|
8
|
+
console.log(data.text);
|
|
9
|
+
console.log({ noSuccess: !!['Ожидает подтверждения', 'В обработке'].find((x) => data.text.includes(x)) });
|
|
10
|
+
yield worker.terminate();
|
|
11
|
+
}))();
|
|
12
|
+
// Статус В обработке
|
package/load.sh
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexushub-commands",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.6",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"axios": "^1.9.0",
|
|
8
8
|
"chalk": "^5.4.1",
|
|
9
|
-
"express": "^5.1.0"
|
|
9
|
+
"express": "^5.1.0",
|
|
10
|
+
"tesseract.js": "^7.0.0"
|
|
10
11
|
},
|
|
11
12
|
"peerDependencies": {
|
|
12
13
|
"evogram": "^2.0.8"
|
package/rus.traineddata
ADDED
|
Binary file
|
|
@@ -49,7 +49,7 @@ export class DepositCommand extends Command {
|
|
|
49
49
|
reply_markup: {
|
|
50
50
|
inline_keyboard: [...(allowedMethods.includes('card') ? [[{ text: '💳 Банковская карта', command: DepositCommand, payload: { method: 'card' } }]] : []), [{ text: '🪙 Криптовалюта', command: DepositCommand, payload: { method: 'cryptowallet' } }], [{ text: '🎫 Промокод', command: DepositByPromocodeCommand }]],
|
|
51
51
|
},
|
|
52
|
-
}
|
|
52
|
+
}
|
|
53
53
|
)
|
|
54
54
|
} else if (value === 'cryptowallet') {
|
|
55
55
|
await context.sendFormatted(
|
|
@@ -67,7 +67,7 @@ export class DepositCommand extends Command {
|
|
|
67
67
|
],
|
|
68
68
|
],
|
|
69
69
|
},
|
|
70
|
-
}
|
|
70
|
+
}
|
|
71
71
|
)
|
|
72
72
|
}
|
|
73
73
|
})
|
|
@@ -97,7 +97,7 @@ export class DepositCommand extends Command {
|
|
|
97
97
|
},
|
|
98
98
|
]),
|
|
99
99
|
},
|
|
100
|
-
}
|
|
100
|
+
}
|
|
101
101
|
)
|
|
102
102
|
} else {
|
|
103
103
|
const wallets = await config.API.get(`/crypto/coins/${value}/wallets`).then((x) => x.data)
|
|
@@ -122,7 +122,7 @@ export class DepositCommand extends Command {
|
|
|
122
122
|
},
|
|
123
123
|
]),
|
|
124
124
|
},
|
|
125
|
-
}
|
|
125
|
+
}
|
|
126
126
|
)
|
|
127
127
|
}
|
|
128
128
|
})
|
|
@@ -252,7 +252,7 @@ export class DepositCommand extends Command {
|
|
|
252
252
|
reply_markup: {
|
|
253
253
|
inline_keyboard: args.suggestedDepositAmounts === false || args.method !== 'card' || suggestedDepositAmountsSetting === 'null' ? undefined : keyboard,
|
|
254
254
|
},
|
|
255
|
-
}
|
|
255
|
+
}
|
|
256
256
|
)
|
|
257
257
|
).text
|
|
258
258
|
},
|
|
@@ -278,9 +278,9 @@ export class DepositCommand extends Command {
|
|
|
278
278
|
if (Number(value) < Number(validateArgs.minAmount)) throw new Error(`Минимальная сумма пополнения: ${Number(validateArgs.minAmount).toLocaleString('ru')} ${config.currency}`)
|
|
279
279
|
|
|
280
280
|
return value
|
|
281
|
-
}
|
|
281
|
+
}
|
|
282
282
|
)
|
|
283
|
-
deposit: number
|
|
283
|
+
deposit: number
|
|
284
284
|
) {
|
|
285
285
|
const config = Client.config(context)
|
|
286
286
|
let interval: NodeJS.Timeout
|
|
@@ -363,7 +363,7 @@ export class DepositCommand extends Command {
|
|
|
363
363
|
reply_markup: {
|
|
364
364
|
inline_keyboard: [[{ text: `💸 Пополнить на ${await minAmount.convert({ from: 'RUB', to: config.currency })}`, command: DepositCommand, payload: { method: 'card', deposit: minAmount } }]],
|
|
365
365
|
},
|
|
366
|
-
}
|
|
366
|
+
}
|
|
367
367
|
)
|
|
368
368
|
}
|
|
369
369
|
}
|
|
@@ -379,7 +379,7 @@ export class DepositCommand extends Command {
|
|
|
379
379
|
reply_markup: {
|
|
380
380
|
inline_keyboard: [[{ text: '👩💻 Поддержка', url: `t.me/${config.support.username}` }]],
|
|
381
381
|
},
|
|
382
|
-
}
|
|
382
|
+
}
|
|
383
383
|
)
|
|
384
384
|
}
|
|
385
385
|
|
|
@@ -392,8 +392,8 @@ export class DepositCommand extends Command {
|
|
|
392
392
|
from: order.currency,
|
|
393
393
|
to: 'RUB',
|
|
394
394
|
ceiled: true,
|
|
395
|
-
|
|
396
|
-
:
|
|
395
|
+
})}) [${order.id}]`
|
|
396
|
+
: `[${order.id}]`
|
|
397
397
|
}`,
|
|
398
398
|
{
|
|
399
399
|
// prettier-ignore
|
|
@@ -406,7 +406,7 @@ export class DepositCommand extends Command {
|
|
|
406
406
|
},
|
|
407
407
|
{
|
|
408
408
|
thumbnail: 'https://i.ibb.co/MDrGBbQR/image.png',
|
|
409
|
-
}
|
|
409
|
+
}
|
|
410
410
|
)
|
|
411
411
|
|
|
412
412
|
if (Number(deposit) !== Number(order.amount) && method !== 'cryptoWallet') {
|
|
@@ -419,29 +419,26 @@ export class DepositCommand extends Command {
|
|
|
419
419
|
reply_markup: {
|
|
420
420
|
inline_keyboard: [[{ text: '📖 Да, я все понял, продолжить', command: GetDepositOrderCommand, payload: { orderId: order.id } }]],
|
|
421
421
|
},
|
|
422
|
-
}
|
|
422
|
+
}
|
|
423
423
|
)
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
-
setTimeout(
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
if (['paid', 'fakepaid'].includes(neworder.status) || neworder.cheque) return
|
|
426
|
+
setTimeout(async () => {
|
|
427
|
+
const neworder = await config.API.get(`/orders/${order.id}`).then((x) => x.data)
|
|
428
|
+
if (['paid', 'fakepaid'].includes(neworder.status) || neworder.cheque) return
|
|
430
429
|
|
|
431
|
-
|
|
432
|
-
|
|
430
|
+
const msgInfo = await context.client.database.config.get(`order${order.id}`)
|
|
431
|
+
if (!msgInfo || neworder.cheque) return
|
|
433
432
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
new Date(order.expiresAt).getTime() - new Date().getTime(),
|
|
444
|
-
)
|
|
433
|
+
context.client.api.deleteMessage({ chat_id: msgInfo.value.chatId, message_id: msgInfo.value.messageId })
|
|
434
|
+
context.sendFormatted({
|
|
435
|
+
designImages: ['deposit-time-expired', 'deposit'],
|
|
436
|
+
header: `<blockquote><b>⚠️ Время на оплату истекло</b></blockquote>\n\n<i>Мы не получили пополнение по нашим реквизитам. Они больше недоступны для пополнения</i>\n\n<b>ℹ️ Если Вы оплатили, а система не определила Ваш перевод - <a href="t.me/${context.mirror.projectMirror.design.supportBot?.username}">обратитесь в тех. поддержку</a></b>`,
|
|
437
|
+
reply_markup: {
|
|
438
|
+
inline_keyboard: [[{ text: '🔄 Проверить оплату', command: CheckPaidOrderCommand, payload: { orderId: order.id } }]],
|
|
439
|
+
},
|
|
440
|
+
})
|
|
441
|
+
}, new Date(order.expiresAt).getTime() - new Date().getTime())
|
|
445
442
|
}
|
|
446
443
|
|
|
447
444
|
context.redirect(GetDepositOrderCommand, { orderId: order.id, repeat: order.isRepeat })
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
2
|
import { CommandArgument, CommandD } from 'evogram'
|
|
3
3
|
import { Command, CommandContext } from 'evogram/lib/migrated'
|
|
4
|
+
import { createWorker } from 'tesseract.js'
|
|
4
5
|
import { Client } from '../../Client'
|
|
5
|
-
const qs = require('qs')
|
|
6
6
|
|
|
7
7
|
@CommandD({ name: 'sendCheque' })
|
|
8
8
|
export class SendChequeCommand extends Command {
|
|
9
|
+
static WORKER = createWorker('rus')
|
|
10
|
+
|
|
9
11
|
public async execute(context: CommandContext, @CommandArgument('orderId') orderId: string) {
|
|
10
12
|
const config = Client.config(context)
|
|
11
13
|
|
|
@@ -34,6 +36,37 @@ export class SendChequeCommand extends Command {
|
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
if (!url) throw new Error('Пожалуйста, отправьте изображение с квитанцией в следующем сообщении')
|
|
39
|
+
|
|
40
|
+
try {
|
|
41
|
+
const worker = await SendChequeCommand.WORKER
|
|
42
|
+
|
|
43
|
+
const { data } = await worker.recognize(url)
|
|
44
|
+
const noSuccess = !!['Ожидает подтверждения', 'В обработке'].find((x) => data.text.includes(x))
|
|
45
|
+
|
|
46
|
+
if (noSuccess) {
|
|
47
|
+
context.sendFormatted(
|
|
48
|
+
{
|
|
49
|
+
designImages: order.method === 'card' ? ['deposit-card', 'deposit'] : order.method === 'cryptoBot' ? ['deposit-crypto-bot', 'deposit-crypto', 'deposit'] : [`deposit-crypto-${order.currency.toLowerCase()}`, 'deposit-crypto-wallet', 'deposit-crypto', 'deposit'],
|
|
50
|
+
photo: config.images.depositCard,
|
|
51
|
+
// prettier-ignore
|
|
52
|
+
header:
|
|
53
|
+
'<blockquote><b>🧾 Подтверждение оплаты счета</b></blockquote>\n\n' +
|
|
54
|
+
|
|
55
|
+
'<i>Система определила, что ваша транзакция на данный момент находится в обработке банка. Пожалуйста, дождитесь подтверждения оплаты и повторите попытку</i>\n\n' +
|
|
56
|
+
|
|
57
|
+
'<b>ℹ️ Как только транзакция будет подтверждена, в квитанции появится статус Подтвержден</b>',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
reply_markup: {
|
|
61
|
+
inline_keyboard: [[{ text: '🔄 Повторить попытку', command: SendChequeCommand, payload: { orderId } }]],
|
|
62
|
+
},
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
} catch (error: any) {
|
|
67
|
+
console.error(error)
|
|
68
|
+
}
|
|
69
|
+
|
|
37
70
|
const photoURL = await axios
|
|
38
71
|
.request({
|
|
39
72
|
method: 'POST',
|
package/src/test.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createWorker } from "tesseract.js";
|
|
2
|
+
|
|
3
|
+
(async () => {
|
|
4
|
+
const worker = await createWorker('rus');
|
|
5
|
+
|
|
6
|
+
const { data } = await worker.recognize(process.argv[2]);
|
|
7
|
+
console.log(data.text);
|
|
8
|
+
|
|
9
|
+
console.log({ noSuccess: !!['Ожидает подтверждения', 'В обработке'].find((x) => data.text.includes(x)) });
|
|
10
|
+
|
|
11
|
+
await worker.terminate();
|
|
12
|
+
})()
|
|
13
|
+
|
|
14
|
+
// Статус В обработке
|