nexushub-commands 2.9.0 → 2.9.2
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.
|
@@ -262,7 +262,7 @@ tslib_1.__decorate([
|
|
|
262
262
|
let minAmount = (_d = minAmountSetting[config.currency]) !== null && _d !== void 0 ? _d : (yield minAmountSetting['RUB'].convert({ from: 'RUB', to: config.currency, ceiled: true }));
|
|
263
263
|
const minDepositByMethod = yield config.API.get('/config/minDepositByMethod').then((x) => x.data.value);
|
|
264
264
|
// prettier-ignore
|
|
265
|
-
if (minDepositByMethod && minDepositByMethod[args.method] !== undefined && (yield minAmount.convert({ from: config.currency, to: 'RUB' })) < minDepositByMethod[args.method])
|
|
265
|
+
if (config.currency.toUpperCase() === 'RUB' && minDepositByMethod && minDepositByMethod[args.method] !== undefined && (yield minAmount.convert({ from: config.currency, to: 'RUB' })) < minDepositByMethod[args.method])
|
|
266
266
|
minAmount = yield minDepositByMethod[args.method].convert({ from: 'RUB', to: config.currency });
|
|
267
267
|
validateArgs.minAmount = minAmount;
|
|
268
268
|
// Функция для красивого округления суммы
|
|
@@ -350,6 +350,8 @@ tslib_1.__decorate([
|
|
|
350
350
|
if (suggestedDepositAmounts) {
|
|
351
351
|
suggestedDepositAmounts = yield Promise.all(suggestedDepositAmounts.map((x) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return Number(yield x.convert({ from: 'RUB', to: config.currency, ceiled: true })); })));
|
|
352
352
|
suggestedDepositAmounts = suggestedDepositAmounts.filter((x) => x >= min && x <= max);
|
|
353
|
+
if (config.currency.toUpperCase() !== 'RUB')
|
|
354
|
+
suggestedDepositAmounts = suggestedDepositAmounts.map((x) => roundToNiceNumber(x));
|
|
353
355
|
}
|
|
354
356
|
// Создаем кнопки (6 кнопок в два ряда по 3)
|
|
355
357
|
const buttons = (suggestedDepositAmounts || amounts).map((amount) => ({
|
package/package.json
CHANGED
|
@@ -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
|
})
|
|
@@ -145,7 +145,7 @@ export class DepositCommand extends Command {
|
|
|
145
145
|
|
|
146
146
|
const minDepositByMethod = await config.API.get('/config/minDepositByMethod').then((x) => x.data.value)
|
|
147
147
|
// prettier-ignore
|
|
148
|
-
if (minDepositByMethod && minDepositByMethod[args.method] !== undefined && (await minAmount.convert({ from: config.currency, to: 'RUB' })) < minDepositByMethod[args.method])
|
|
148
|
+
if (config.currency.toUpperCase() === 'RUB' && minDepositByMethod && minDepositByMethod[args.method] !== undefined && (await minAmount.convert({ from: config.currency, to: 'RUB' })) < minDepositByMethod[args.method])
|
|
149
149
|
minAmount = await minDepositByMethod[args.method].convert({ from: 'RUB', to: config.currency });
|
|
150
150
|
|
|
151
151
|
validateArgs.minAmount = minAmount
|
|
@@ -240,6 +240,8 @@ export class DepositCommand extends Command {
|
|
|
240
240
|
if (suggestedDepositAmounts) {
|
|
241
241
|
suggestedDepositAmounts = await Promise.all(suggestedDepositAmounts.map(async (x) => Number(await x.convert({ from: 'RUB', to: config.currency, ceiled: true }))))
|
|
242
242
|
suggestedDepositAmounts = suggestedDepositAmounts.filter((x) => x >= min && x <= max)
|
|
243
|
+
|
|
244
|
+
if (config.currency.toUpperCase() !== 'RUB') suggestedDepositAmounts = suggestedDepositAmounts.map((x) => roundToNiceNumber(x))
|
|
243
245
|
}
|
|
244
246
|
|
|
245
247
|
// Создаем кнопки (6 кнопок в два ряда по 3)
|
|
@@ -268,7 +270,7 @@ export class DepositCommand extends Command {
|
|
|
268
270
|
reply_markup: {
|
|
269
271
|
inline_keyboard: args.suggestedDepositAmounts === false || args.method !== 'card' || suggestedDepositAmountsSetting === 'null' ? undefined : keyboard,
|
|
270
272
|
},
|
|
271
|
-
}
|
|
273
|
+
},
|
|
272
274
|
)
|
|
273
275
|
).text
|
|
274
276
|
},
|
|
@@ -294,9 +296,9 @@ export class DepositCommand extends Command {
|
|
|
294
296
|
if (Number(value) < Number(validateArgs.minAmount)) throw new Error(`Минимальная сумма пополнения: ${Number(validateArgs.minAmount).toLocaleString('ru')} ${config.currency}`)
|
|
295
297
|
|
|
296
298
|
return value
|
|
297
|
-
}
|
|
299
|
+
},
|
|
298
300
|
)
|
|
299
|
-
deposit: number
|
|
301
|
+
deposit: number,
|
|
300
302
|
) {
|
|
301
303
|
const config = Client.config(context)
|
|
302
304
|
let interval: NodeJS.Timeout
|
|
@@ -379,7 +381,7 @@ export class DepositCommand extends Command {
|
|
|
379
381
|
reply_markup: {
|
|
380
382
|
inline_keyboard: [[{ text: `💸 Пополнить на ${await minAmount.convert({ from: 'RUB', to: config.currency })}`, command: DepositCommand, payload: { method: 'card', deposit: minAmount } }]],
|
|
381
383
|
},
|
|
382
|
-
}
|
|
384
|
+
},
|
|
383
385
|
)
|
|
384
386
|
}
|
|
385
387
|
}
|
|
@@ -395,7 +397,7 @@ export class DepositCommand extends Command {
|
|
|
395
397
|
reply_markup: {
|
|
396
398
|
inline_keyboard: [[{ text: '👩💻 Поддержка', url: `t.me/${config.support.username}` }]],
|
|
397
399
|
},
|
|
398
|
-
}
|
|
400
|
+
},
|
|
399
401
|
)
|
|
400
402
|
}
|
|
401
403
|
|
|
@@ -408,7 +410,7 @@ export class DepositCommand extends Command {
|
|
|
408
410
|
from: order.currency,
|
|
409
411
|
to: 'RUB',
|
|
410
412
|
ceiled: true,
|
|
411
|
-
|
|
413
|
+
})}) [${order.id}]`
|
|
412
414
|
: `[${order.id}]`
|
|
413
415
|
}`,
|
|
414
416
|
{
|
|
@@ -422,7 +424,7 @@ export class DepositCommand extends Command {
|
|
|
422
424
|
},
|
|
423
425
|
{
|
|
424
426
|
thumbnail: 'https://i.ibb.co/MDrGBbQR/image.png',
|
|
425
|
-
}
|
|
427
|
+
},
|
|
426
428
|
)
|
|
427
429
|
|
|
428
430
|
if (Number(deposit) !== Number(order.amount) && method !== 'cryptoWallet') {
|
|
@@ -435,26 +437,29 @@ export class DepositCommand extends Command {
|
|
|
435
437
|
reply_markup: {
|
|
436
438
|
inline_keyboard: [[{ text: '📖 Да, я все понял, продолжить', command: GetDepositOrderCommand, payload: { orderId: order.id } }]],
|
|
437
439
|
},
|
|
438
|
-
}
|
|
440
|
+
},
|
|
439
441
|
)
|
|
440
442
|
}
|
|
441
443
|
|
|
442
|
-
setTimeout(
|
|
443
|
-
|
|
444
|
-
|
|
444
|
+
setTimeout(
|
|
445
|
+
async () => {
|
|
446
|
+
const neworder = await config.API.get(`/orders/${order.id}`).then((x) => x.data)
|
|
447
|
+
if (['paid', 'fakepaid'].includes(neworder.status) || neworder.cheque) return
|
|
445
448
|
|
|
446
|
-
|
|
447
|
-
|
|
449
|
+
const msgInfo = await context.client.database.config.get(`order${order.id}`)
|
|
450
|
+
if (!msgInfo || neworder.cheque) return
|
|
448
451
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
452
|
+
context.client.api.deleteMessage({ chat_id: msgInfo.value.chatId, message_id: msgInfo.value.messageId })
|
|
453
|
+
context.sendFormatted({
|
|
454
|
+
designImages: ['deposit-time-expired', 'deposit'],
|
|
455
|
+
header: `<blockquote><b>⚠️ Время на оплату истекло</b></blockquote>\n\n<i>Мы не получили пополнение по нашим реквизитам. Они больше недоступны для пополнения</i>\n\n<b>ℹ️ Если Вы оплатили, а система не определила Ваш перевод - <a href="t.me/${context.mirror.projectMirror.design.supportBot?.username}">обратитесь в тех. поддержку</a></b>`,
|
|
456
|
+
reply_markup: {
|
|
457
|
+
inline_keyboard: [[{ text: '🔄 Проверить оплату', command: CheckPaidOrderCommand, payload: { orderId: order.id } }]],
|
|
458
|
+
},
|
|
459
|
+
})
|
|
460
|
+
},
|
|
461
|
+
new Date(order.expiresAt).getTime() - new Date().getTime(),
|
|
462
|
+
)
|
|
458
463
|
}
|
|
459
464
|
|
|
460
465
|
context.redirect(GetDepositOrderCommand, { orderId: order.id, repeat: order.isRepeat })
|