nexushub-commands 1.4.0 → 1.4.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.
- package/lib/commands/deposit/Deposit.command.js +20 -15
- package/lib/commands/deposit/GetDepositOrder.command.d.ts +1 -1
- package/lib/commands/deposit/GetDepositOrder.command.js +4 -3
- package/package.json +1 -1
- package/src/commands/deposit/Deposit.command.ts +18 -13
- package/src/commands/deposit/GetDepositOrder.command.ts +2 -2
|
@@ -6,6 +6,7 @@ const evogram_1 = require("evogram");
|
|
|
6
6
|
const migrated_1 = require("evogram/lib/migrated");
|
|
7
7
|
const Client_1 = require("../../Client");
|
|
8
8
|
const formatMessage_1 = require("../../utils/formatMessage");
|
|
9
|
+
const CheckPaidOrder_command_1 = require("./CheckPaidOrder.command");
|
|
9
10
|
const GetDepositOrder_command_1 = require("./GetDepositOrder.command");
|
|
10
11
|
// Функция для маскировки реквизитов: оставляет только последние 4 не пробельных символа
|
|
11
12
|
function maskExceptLast4(str) {
|
|
@@ -117,7 +118,7 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
|
|
|
117
118
|
keyboard: [[{ text: '🚀 Оплатить счет', callback_data: `PaidOrderCommand?orderId=${order.id}` }]],
|
|
118
119
|
});
|
|
119
120
|
if (Number(deposit) !== Number(order.amount)) {
|
|
120
|
-
context.sendFormatted({
|
|
121
|
+
return context.sendFormatted({
|
|
121
122
|
photo: config.images.deposit,
|
|
122
123
|
header: `<blockquote><b>ℹ️ Сумма пополнения стала выше</b></blockquote>\n\n<i>Для определения вашего пополнения в системе, Вам придется заплатить ${Number(order.amount).toLocaleString('ru')} ${order.currency.toUpperCase()}. Приносим свои извинения за неудобства</i>`,
|
|
123
124
|
}, {
|
|
@@ -126,21 +127,25 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
|
|
|
126
127
|
},
|
|
127
128
|
});
|
|
128
129
|
}
|
|
130
|
+
setTimeout(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
var _a;
|
|
132
|
+
const neworder = yield config.API.get(`/orders/${order.id}`).then((x) => x.data);
|
|
133
|
+
if (['paid', 'fakepaid'].includes(neworder.status) || neworder.cheque)
|
|
134
|
+
return;
|
|
135
|
+
const msgInfo = yield context.client.database.config.get(`order${order.id}`);
|
|
136
|
+
if (!msgInfo)
|
|
137
|
+
return;
|
|
138
|
+
context.client.api.deleteMessage({ chat_id: msgInfo.value.chatId, message_id: msgInfo.value.messageId });
|
|
139
|
+
context.sendFormatted({
|
|
140
|
+
photo: config.images.deposit,
|
|
141
|
+
header: `<blockquote><b>⚠️ Время на оплату истекло</b></blockquote>\n\n<i>Мы не получили пополнение по нашим реквизитам. Они больше недоступны для пополнения</i>\n\n<b>ℹ️ Если Вы оплатили, а система не определила Ваш перевод - <a href="t.me/${(_a = context.mirror.projectMirror.design.supportBot) === null || _a === void 0 ? void 0 : _a.username}">обратитесь в тех. поддержку</a></b>`,
|
|
142
|
+
reply_markup: {
|
|
143
|
+
inline_keyboard: [[{ text: '🔄 Проверить оплату', command: CheckPaidOrder_command_1.CheckPaidOrderCommand, payload: { orderId: order.id } }]],
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
}), new Date(order.expiresAt).getTime() - new Date().getTime());
|
|
129
147
|
}
|
|
130
|
-
|
|
131
|
-
var _a;
|
|
132
|
-
const neworder = yield config.API.get(`/orders/${order.id}`).then((x) => x.data);
|
|
133
|
-
if (['paid', 'fakepaid'].includes(neworder.status) || neworder.cheque)
|
|
134
|
-
return;
|
|
135
|
-
const msgInfo = yield context.client.database.config.get(`order${order.id}`);
|
|
136
|
-
if (!msgInfo)
|
|
137
|
-
return;
|
|
138
|
-
context.client.api.deleteMessage({ chat_id: msgInfo.value.chatId, message_id: msgInfo.value.messageId });
|
|
139
|
-
context.sendFormatted({
|
|
140
|
-
header: `<blockquote>⚠️ Время на оплату прошло</blockquote>\n\n<i>Мы не получили пополнение по нашим реквизитам. Они больше недоступны для пополнения</i>\n\n<b>ℹ️ Если Вы оплатили, а система не определила Ваш перевод - <a href="t.me/${(_a = context.mirror.projectMirror.design.supportBot) === null || _a === void 0 ? void 0 : _a.username}">обратитесь в тех. поддержку</a></b>`,
|
|
141
|
-
});
|
|
142
|
-
}), new Date(order.expiresAt).getTime() - new Date().getTime());
|
|
143
|
-
context.redirect(GetDepositOrder_command_1.GetDepositOrderCommand, { orderId: order.id });
|
|
148
|
+
context.redirect(GetDepositOrder_command_1.GetDepositOrderCommand, { orderId: order.id, repeat: order.isRepeat });
|
|
144
149
|
}
|
|
145
150
|
else {
|
|
146
151
|
const wallets = (yield config.API.get('/crypto/wallets')).data.filter((x) => x.isActive);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from 'evogram';
|
|
2
2
|
import { CommandContext } from 'evogram/lib/migrated';
|
|
3
3
|
export declare class GetDepositOrderCommand extends Command {
|
|
4
|
-
execute(context: CommandContext, orderId: string): Promise<void>;
|
|
4
|
+
execute(context: CommandContext, orderId: string, repeat?: boolean): Promise<void>;
|
|
5
5
|
}
|
|
@@ -8,7 +8,7 @@ const Client_1 = require("../../Client");
|
|
|
8
8
|
const CheckPaidOrder_command_1 = require("./CheckPaidOrder.command");
|
|
9
9
|
const SendCheque_command_1 = require("./SendCheque.command");
|
|
10
10
|
let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Command {
|
|
11
|
-
execute(context, orderId) {
|
|
11
|
+
execute(context, orderId, repeat) {
|
|
12
12
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
13
|
const config = Client_1.Client.config(context);
|
|
14
14
|
const order = yield config.API.get(`/orders/${orderId}`)
|
|
@@ -48,7 +48,7 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
48
48
|
case 'card':
|
|
49
49
|
message = yield context.sendFormatted({
|
|
50
50
|
photo: config.images.deposit,
|
|
51
|
-
header:
|
|
51
|
+
header: repeat ? '<b>❗️У вас уже есть заявка на пополнение, сначала оплатите ёё</b>' : '<b>Создана заявка на оплату</b>',
|
|
52
52
|
body: [
|
|
53
53
|
{
|
|
54
54
|
title: 'ℹ️ Информация о реквизитах',
|
|
@@ -96,8 +96,9 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
96
96
|
exports.GetDepositOrderCommand = GetDepositOrderCommand;
|
|
97
97
|
tslib_1.__decorate([
|
|
98
98
|
tslib_1.__param(1, (0, evogram_1.CommandArgument)('orderId')),
|
|
99
|
+
tslib_1.__param(2, (0, evogram_1.CommandArgument)('repeat?')),
|
|
99
100
|
tslib_1.__metadata("design:type", Function),
|
|
100
|
-
tslib_1.__metadata("design:paramtypes", [migrated_1.CommandContext, String]),
|
|
101
|
+
tslib_1.__metadata("design:paramtypes", [migrated_1.CommandContext, String, Boolean]),
|
|
101
102
|
tslib_1.__metadata("design:returntype", Promise)
|
|
102
103
|
], GetDepositOrderCommand.prototype, "execute", null);
|
|
103
104
|
exports.GetDepositOrderCommand = GetDepositOrderCommand = tslib_1.__decorate([
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { Command, CommandArgument, CommandD, numberValidator } from 'evogram';
|
|
|
2
2
|
import { CommandContext } from 'evogram/lib/migrated';
|
|
3
3
|
import { Client } from '../../Client';
|
|
4
4
|
import { formatMessage } from '../../utils/formatMessage';
|
|
5
|
+
import { CheckPaidOrderCommand } from './CheckPaidOrder.command';
|
|
5
6
|
import { GetDepositOrderCommand } from './GetDepositOrder.command';
|
|
6
7
|
|
|
7
8
|
// Функция для маскировки реквизитов: оставляет только последние 4 не пробельных символа
|
|
@@ -269,7 +270,7 @@ export class DepositCommand extends Command {
|
|
|
269
270
|
);
|
|
270
271
|
|
|
271
272
|
if (Number(deposit) !== Number(order.amount)) {
|
|
272
|
-
context.sendFormatted(
|
|
273
|
+
return context.sendFormatted(
|
|
273
274
|
{
|
|
274
275
|
photo: config.images.deposit,
|
|
275
276
|
header: `<blockquote><b>ℹ️ Сумма пополнения стала выше</b></blockquote>\n\n<i>Для определения вашего пополнения в системе, Вам придется заплатить ${Number(
|
|
@@ -283,22 +284,26 @@ export class DepositCommand extends Command {
|
|
|
283
284
|
}
|
|
284
285
|
);
|
|
285
286
|
}
|
|
286
|
-
}
|
|
287
287
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
setTimeout(async () => {
|
|
289
|
+
const neworder = await config.API.get(`/orders/${order.id}`).then((x) => x.data);
|
|
290
|
+
if (['paid', 'fakepaid'].includes(neworder.status) || neworder.cheque) return;
|
|
291
291
|
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
const msgInfo = await context.client.database.config.get(`order${order.id}`);
|
|
293
|
+
if (!msgInfo) return;
|
|
294
294
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
295
|
+
context.client.api.deleteMessage({ chat_id: msgInfo.value.chatId, message_id: msgInfo.value.messageId });
|
|
296
|
+
context.sendFormatted({
|
|
297
|
+
photo: config.images.deposit,
|
|
298
|
+
header: `<blockquote><b>⚠️ Время на оплату истекло</b></blockquote>\n\n<i>Мы не получили пополнение по нашим реквизитам. Они больше недоступны для пополнения</i>\n\n<b>ℹ️ Если Вы оплатили, а система не определила Ваш перевод - <a href="t.me/${context.mirror.projectMirror.design.supportBot?.username}">обратитесь в тех. поддержку</a></b>`,
|
|
299
|
+
reply_markup: {
|
|
300
|
+
inline_keyboard: [[{ text: '🔄 Проверить оплату', command: CheckPaidOrderCommand, payload: { orderId: order.id } }]],
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
}, new Date(order.expiresAt).getTime() - new Date().getTime());
|
|
304
|
+
}
|
|
300
305
|
|
|
301
|
-
context.redirect(GetDepositOrderCommand, { orderId: order.id });
|
|
306
|
+
context.redirect(GetDepositOrderCommand, { orderId: order.id, repeat: order.isRepeat });
|
|
302
307
|
} else {
|
|
303
308
|
const wallets = (await config.API.get('/crypto/wallets')).data.filter((x: any) => x.isActive);
|
|
304
309
|
|
|
@@ -6,7 +6,7 @@ import { SendChequeCommand } from './SendCheque.command';
|
|
|
6
6
|
|
|
7
7
|
@CommandD({ name: 'getDepositOrder', backButton: 'К пополнению' })
|
|
8
8
|
export class GetDepositOrderCommand extends Command {
|
|
9
|
-
public async execute(context: CommandContext, @CommandArgument('orderId') orderId: string) {
|
|
9
|
+
public async execute(context: CommandContext, @CommandArgument('orderId') orderId: string, @CommandArgument('repeat?') repeat?: boolean) {
|
|
10
10
|
const config = Client.config(context);
|
|
11
11
|
const order = await config.API.get(`/orders/${orderId}`)
|
|
12
12
|
.then((x) => x.data)
|
|
@@ -51,7 +51,7 @@ export class GetDepositOrderCommand extends Command {
|
|
|
51
51
|
message = await context.sendFormatted(
|
|
52
52
|
{
|
|
53
53
|
photo: config.images.deposit,
|
|
54
|
-
header:
|
|
54
|
+
header: repeat ? '<b>❗️У вас уже есть заявка на пополнение, сначала оплатите ёё</b>' : '<b>Создана заявка на оплату</b>',
|
|
55
55
|
body: [
|
|
56
56
|
{
|
|
57
57
|
title: 'ℹ️ Информация о реквизитах',
|