nexushub-commands 1.3.2 → 1.4.0
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 +38 -3
- package/lib/commands/deposit/GetDepositOrder.command.d.ts +1 -1
- package/lib/commands/deposit/GetDepositOrder.command.js +7 -3
- package/package.json +1 -1
- package/src/commands/deposit/Deposit.command.ts +43 -3
- package/src/commands/deposit/GetDepositOrder.command.ts +9 -3
|
@@ -74,6 +74,17 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
|
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
+
else {
|
|
78
|
+
order = yield config.API.post(`orders`, {
|
|
79
|
+
mirrorId: context.mammoth.mirror.mirror.id,
|
|
80
|
+
mammothId: context.user.id,
|
|
81
|
+
method,
|
|
82
|
+
amount: Number(deposit),
|
|
83
|
+
currency: config.currency,
|
|
84
|
+
})
|
|
85
|
+
.then((x) => x.data)
|
|
86
|
+
.catch(() => null);
|
|
87
|
+
}
|
|
77
88
|
//@ts-ignore
|
|
78
89
|
if (interval)
|
|
79
90
|
clearInterval(interval);
|
|
@@ -90,7 +101,7 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
|
|
|
90
101
|
},
|
|
91
102
|
});
|
|
92
103
|
}
|
|
93
|
-
if (!order.isRepeat)
|
|
104
|
+
if (!order.isRepeat) {
|
|
94
105
|
yield context.user.log(0, `Запросил пополнение на ${Number(order.amount).toLocaleString('ru')} ${order.currency} ${order.currency !== 'RUB'
|
|
95
106
|
? `(${yield order.amount.convert({
|
|
96
107
|
from: order.currency,
|
|
@@ -105,11 +116,35 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
|
|
|
105
116
|
: '',
|
|
106
117
|
keyboard: [[{ text: '🚀 Оплатить счет', callback_data: `PaidOrderCommand?orderId=${order.id}` }]],
|
|
107
118
|
});
|
|
108
|
-
|
|
119
|
+
if (Number(deposit) !== Number(order.amount)) {
|
|
120
|
+
context.sendFormatted({
|
|
121
|
+
photo: config.images.deposit,
|
|
122
|
+
header: `<blockquote><b>ℹ️ Сумма пополнения стала выше</b></blockquote>\n\n<i>Для определения вашего пополнения в системе, Вам придется заплатить ${Number(order.amount).toLocaleString('ru')} ${order.currency.toUpperCase()}. Приносим свои извинения за неудобства</i>`,
|
|
123
|
+
}, {
|
|
124
|
+
reply_markup: {
|
|
125
|
+
inline_keyboard: [[{ text: '📖 Да, я все понял, продолжить', command: GetDepositOrder_command_1.GetDepositOrderCommand, payload: { orderId: order.id } }]],
|
|
126
|
+
},
|
|
127
|
+
});
|
|
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
|
+
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 });
|
|
109
144
|
}
|
|
110
145
|
else {
|
|
111
146
|
const wallets = (yield config.API.get('/crypto/wallets')).data.filter((x) => x.isActive);
|
|
112
|
-
|
|
147
|
+
context.sendFormatted({
|
|
113
148
|
photo: config.images.depositCrypto,
|
|
114
149
|
header: '<b>Создана заявка на оплату</b>',
|
|
115
150
|
body: [
|
|
@@ -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<
|
|
4
|
+
execute(context: CommandContext, orderId: string): Promise<void>;
|
|
5
5
|
}
|
|
@@ -16,9 +16,10 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
16
16
|
.catch(() => null);
|
|
17
17
|
if (!order)
|
|
18
18
|
throw new Error('Заявка на оплату не найдена');
|
|
19
|
+
let message;
|
|
19
20
|
switch (order.method) {
|
|
20
21
|
case 'cryptoBot':
|
|
21
|
-
|
|
22
|
+
message = yield context.sendFormatted({
|
|
22
23
|
photo: config.images.depositCrypto,
|
|
23
24
|
header: '<b>Создана заявка на оплату</b>',
|
|
24
25
|
body: [
|
|
@@ -43,8 +44,9 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
43
44
|
],
|
|
44
45
|
},
|
|
45
46
|
});
|
|
47
|
+
break;
|
|
46
48
|
case 'card':
|
|
47
|
-
|
|
49
|
+
message = yield context.sendFormatted({
|
|
48
50
|
photo: config.images.deposit,
|
|
49
51
|
header: order.isRepeat ? '<b>❗️У вас уже есть заявка на пополнение, сначала оплатите ёё</b>' : '<b>Создана заявка на оплату</b>',
|
|
50
52
|
body: [
|
|
@@ -69,8 +71,9 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
69
71
|
],
|
|
70
72
|
},
|
|
71
73
|
});
|
|
74
|
+
break;
|
|
72
75
|
case 'qrcode':
|
|
73
|
-
|
|
76
|
+
message = yield context.sendFormatted({
|
|
74
77
|
photo: config.images.deposit,
|
|
75
78
|
header: '<b>Создана заявка на оплату</b>',
|
|
76
79
|
footer: `<i>Ссылка действительна ${Math.ceil((new Date(order.expiresAt).getTime() - new Date().getTime()) / 60000)} минут.</i>`,
|
|
@@ -86,6 +89,7 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
86
89
|
},
|
|
87
90
|
});
|
|
88
91
|
}
|
|
92
|
+
yield this.client.database.config.set(`order${orderId}`, { chatId: context.chat.id, messageId: message.id });
|
|
89
93
|
});
|
|
90
94
|
}
|
|
91
95
|
};
|
package/package.json
CHANGED
|
@@ -213,6 +213,16 @@ export class DepositCommand extends Command {
|
|
|
213
213
|
|
|
214
214
|
if (order) break;
|
|
215
215
|
}
|
|
216
|
+
} else {
|
|
217
|
+
order = await config.API.post(`orders`, {
|
|
218
|
+
mirrorId: context.mammoth.mirror.mirror.id,
|
|
219
|
+
mammothId: context.user.id,
|
|
220
|
+
method,
|
|
221
|
+
amount: Number(deposit),
|
|
222
|
+
currency: config.currency,
|
|
223
|
+
})
|
|
224
|
+
.then((x) => x.data)
|
|
225
|
+
.catch(() => null);
|
|
216
226
|
}
|
|
217
227
|
|
|
218
228
|
//@ts-ignore
|
|
@@ -235,7 +245,7 @@ export class DepositCommand extends Command {
|
|
|
235
245
|
);
|
|
236
246
|
}
|
|
237
247
|
|
|
238
|
-
if (!order.isRepeat)
|
|
248
|
+
if (!order.isRepeat) {
|
|
239
249
|
await context.user.log(
|
|
240
250
|
0,
|
|
241
251
|
`Запросил пополнение на ${Number(order.amount).toLocaleString('ru')} ${order.currency} ${
|
|
@@ -258,11 +268,41 @@ export class DepositCommand extends Command {
|
|
|
258
268
|
}
|
|
259
269
|
);
|
|
260
270
|
|
|
261
|
-
|
|
271
|
+
if (Number(deposit) !== Number(order.amount)) {
|
|
272
|
+
context.sendFormatted(
|
|
273
|
+
{
|
|
274
|
+
photo: config.images.deposit,
|
|
275
|
+
header: `<blockquote><b>ℹ️ Сумма пополнения стала выше</b></blockquote>\n\n<i>Для определения вашего пополнения в системе, Вам придется заплатить ${Number(
|
|
276
|
+
order.amount
|
|
277
|
+
).toLocaleString('ru')} ${order.currency.toUpperCase()}. Приносим свои извинения за неудобства</i>`,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
reply_markup: {
|
|
281
|
+
inline_keyboard: [[{ text: '📖 Да, я все понял, продолжить', command: GetDepositOrderCommand, payload: { orderId: order.id } }]],
|
|
282
|
+
},
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
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
|
+
|
|
292
|
+
const msgInfo = await context.client.database.config.get(`order${order.id}`);
|
|
293
|
+
if (!msgInfo) return;
|
|
294
|
+
|
|
295
|
+
context.client.api.deleteMessage({ chat_id: msgInfo.value.chatId, message_id: msgInfo.value.messageId });
|
|
296
|
+
context.sendFormatted({
|
|
297
|
+
header: `<blockquote>⚠️ Время на оплату прошло</blockquote>\n\n<i>Мы не получили пополнение по нашим реквизитам. Они больше недоступны для пополнения</i>\n\n<b>ℹ️ Если Вы оплатили, а система не определила Ваш перевод - <a href="t.me/${context.mirror.projectMirror.design.supportBot?.username}">обратитесь в тех. поддержку</a></b>`,
|
|
298
|
+
});
|
|
299
|
+
}, new Date(order.expiresAt).getTime() - new Date().getTime());
|
|
300
|
+
|
|
301
|
+
context.redirect(GetDepositOrderCommand, { orderId: order.id });
|
|
262
302
|
} else {
|
|
263
303
|
const wallets = (await config.API.get('/crypto/wallets')).data.filter((x: any) => x.isActive);
|
|
264
304
|
|
|
265
|
-
|
|
305
|
+
context.sendFormatted({
|
|
266
306
|
photo: config.images.depositCrypto,
|
|
267
307
|
header: '<b>Создана заявка на оплату</b>',
|
|
268
308
|
body: [
|
|
@@ -13,10 +13,11 @@ export class GetDepositOrderCommand extends Command {
|
|
|
13
13
|
.catch(() => null);
|
|
14
14
|
|
|
15
15
|
if (!order) throw new Error('Заявка на оплату не найдена');
|
|
16
|
+
let message;
|
|
16
17
|
|
|
17
18
|
switch (order.method) {
|
|
18
19
|
case 'cryptoBot':
|
|
19
|
-
|
|
20
|
+
message = await context.sendFormatted(
|
|
20
21
|
{
|
|
21
22
|
photo: config.images.depositCrypto,
|
|
22
23
|
header: '<b>Создана заявка на оплату</b>',
|
|
@@ -44,8 +45,10 @@ export class GetDepositOrderCommand extends Command {
|
|
|
44
45
|
},
|
|
45
46
|
}
|
|
46
47
|
);
|
|
48
|
+
|
|
49
|
+
break;
|
|
47
50
|
case 'card':
|
|
48
|
-
|
|
51
|
+
message = await context.sendFormatted(
|
|
49
52
|
{
|
|
50
53
|
photo: config.images.deposit,
|
|
51
54
|
header: order.isRepeat ? '<b>❗️У вас уже есть заявка на пополнение, сначала оплатите ёё</b>' : '<b>Создана заявка на оплату</b>',
|
|
@@ -73,8 +76,9 @@ export class GetDepositOrderCommand extends Command {
|
|
|
73
76
|
},
|
|
74
77
|
}
|
|
75
78
|
);
|
|
79
|
+
break;
|
|
76
80
|
case 'qrcode':
|
|
77
|
-
|
|
81
|
+
message = await context.sendFormatted(
|
|
78
82
|
{
|
|
79
83
|
photo: config.images.deposit,
|
|
80
84
|
header: '<b>Создана заявка на оплату</b>',
|
|
@@ -93,5 +97,7 @@ export class GetDepositOrderCommand extends Command {
|
|
|
93
97
|
}
|
|
94
98
|
);
|
|
95
99
|
}
|
|
100
|
+
|
|
101
|
+
await this.client.database.config.set(`order${orderId}`, { chatId: context.chat.id, messageId: message.id });
|
|
96
102
|
}
|
|
97
103
|
}
|