nexushub-commands 2.2.2 → 2.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/Client.d.ts +1 -0
- package/lib/commands/deposit/Deposit.command.d.ts +1 -1
- package/lib/commands/deposit/Deposit.command.js +18 -10
- package/lib/commands/deposit/DepositByPromocode.command.js +3 -3
- package/lib/commands/deposit/GetDepositOrder.command.d.ts +1 -1
- package/lib/commands/deposit/GetDepositOrder.command.js +5 -3
- package/lib/commands/deposit/SendCheque.command.js +2 -1
- package/lib/commands/registration/Registration.command.js +4 -2
- package/load.sh +15 -0
- package/package.json +1 -1
- package/src/Client.ts +1 -0
- package/src/commands/deposit/Deposit.command.ts +18 -8
- package/src/commands/deposit/DepositByPromocode.command.ts +15 -16
- package/src/commands/deposit/GetDepositOrder.command.ts +5 -2
- package/src/commands/deposit/SendCheque.command.ts +2 -1
- package/src/commands/registration/Registration.command.ts +4 -2
package/lib/Client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from 'evogram';
|
|
2
2
|
import { CommandContext } from 'evogram/lib/migrated';
|
|
3
3
|
export declare class DepositCommand extends Command {
|
|
4
|
-
execute(context: CommandContext, method: string, coin: string | undefined, deposit: number): Promise<any>;
|
|
4
|
+
execute(context: CommandContext & Record<string, any>, method: string, coin: string | undefined, deposit: number): Promise<any>;
|
|
5
5
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DepositCommand = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const evogram_1 = require("evogram");
|
|
6
|
-
const migrated_1 = require("evogram/lib/migrated");
|
|
7
6
|
const Client_1 = require("../../Client");
|
|
8
7
|
const formatMessage_1 = require("../../utils/formatMessage");
|
|
9
8
|
const CheckPaidOrder_command_1 = require("./CheckPaidOrder.command");
|
|
@@ -29,7 +28,7 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
|
|
|
29
28
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
29
|
const config = Client_1.Client.config(context);
|
|
31
30
|
let interval;
|
|
32
|
-
if (['card'
|
|
31
|
+
if (['card'].includes(method)) {
|
|
33
32
|
const message = yield context.sendFormatted({
|
|
34
33
|
photo: config.images.deposit,
|
|
35
34
|
header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Создаем заявку на пополнение...</i>',
|
|
@@ -50,7 +49,7 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
|
|
|
50
49
|
}
|
|
51
50
|
let order;
|
|
52
51
|
if (method === 'card') {
|
|
53
|
-
for (const _method of [
|
|
52
|
+
for (const _method of ['card']) {
|
|
54
53
|
method = _method;
|
|
55
54
|
order = yield config.API.post(`orders`, {
|
|
56
55
|
mirrorId: context.mammoth.mirror.mirror.id,
|
|
@@ -84,6 +83,7 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
|
|
|
84
83
|
if (!order) {
|
|
85
84
|
context.user.log(0, `Не удалось получить реквизиты для пополнения на сумму ${Number(deposit).toLocaleString('ru')} ${config.currency}`);
|
|
86
85
|
return context.sendFormatted({
|
|
86
|
+
designImages: ['deposit-no-requisite', 'deposit'],
|
|
87
87
|
photo: config.images.deposit,
|
|
88
88
|
header: '<b>❗️К сожалению, сейчас нет доступных реквизитов для оплаты.</b>',
|
|
89
89
|
footer: `<i>ℹ️ Вы можете попробовать чуть позже, воспользоваться другим способом оплаты, либо связаться с <a href="t.me/{{ ${config.support.username} }}">технической поддержкой</a>.</i>`,
|
|
@@ -130,7 +130,7 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
|
|
|
130
130
|
return;
|
|
131
131
|
context.client.api.deleteMessage({ chat_id: msgInfo.value.chatId, message_id: msgInfo.value.messageId });
|
|
132
132
|
context.sendFormatted({
|
|
133
|
-
|
|
133
|
+
designImages: ['deposit-time-expired', 'deposit'],
|
|
134
134
|
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>`,
|
|
135
135
|
reply_markup: {
|
|
136
136
|
inline_keyboard: [[{ text: '🔄 Проверить оплату', command: CheckPaidOrder_command_1.CheckPaidOrderCommand, payload: { orderId: order.id } }]],
|
|
@@ -156,6 +156,7 @@ tslib_1.__decorate([
|
|
|
156
156
|
if (!value) {
|
|
157
157
|
const allowedMethods = (yield config.API.get('/orders/allowedMethods', { params: { currency: config.currency } })).data;
|
|
158
158
|
yield context.sendFormatted({
|
|
159
|
+
designImages: ['deposit'],
|
|
159
160
|
photo: config.images.deposit,
|
|
160
161
|
header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Выберите удобный для Вас метод пополнения.</i>',
|
|
161
162
|
}, {
|
|
@@ -166,6 +167,7 @@ tslib_1.__decorate([
|
|
|
166
167
|
}
|
|
167
168
|
else if (value === 'cryptowallet') {
|
|
168
169
|
yield context.sendFormatted({
|
|
170
|
+
designImages: ['deposit-crypto', 'deposit'],
|
|
169
171
|
photo: config.images.depositCrypto,
|
|
170
172
|
header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите удобный для Вас метод пополнения.</i>',
|
|
171
173
|
}, {
|
|
@@ -189,8 +191,9 @@ tslib_1.__decorate([
|
|
|
189
191
|
if (!value) {
|
|
190
192
|
const wallets = yield config.API.get('/crypto/coins').then((x) => x.data);
|
|
191
193
|
context.sendFormatted({
|
|
192
|
-
header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую криптовалюту для пополнения</i>',
|
|
193
194
|
photo: config.images.depositCrypto,
|
|
195
|
+
designImages: ['deposit-crypto-wallet', 'deposit-crypto', 'deposit'],
|
|
196
|
+
header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую криптовалюту для пополнения</i>',
|
|
194
197
|
}, {
|
|
195
198
|
reply_markup: {
|
|
196
199
|
inline_keyboard: wallets.map((x) => [
|
|
@@ -205,18 +208,21 @@ tslib_1.__decorate([
|
|
|
205
208
|
}
|
|
206
209
|
else {
|
|
207
210
|
const wallets = yield config.API.get(`/crypto/coins/${value}/wallets`).then((x) => x.data);
|
|
208
|
-
if (wallets.length === 1)
|
|
211
|
+
if (wallets.length === 1) {
|
|
212
|
+
args.crypto = value === null || value === void 0 ? void 0 : value.toLowerCase();
|
|
209
213
|
return wallets[0].id;
|
|
214
|
+
}
|
|
210
215
|
context.sendFormatted({
|
|
211
|
-
header: `<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую сеть для пополнения в ${value}</i>`,
|
|
212
216
|
photo: config.images.depositCrypto,
|
|
217
|
+
designImages: [`deposit-crypto-${value === null || value === void 0 ? void 0 : value.toLowerCase()}`, 'deposit-crypto-wallet', 'deposit-crypto', 'deposit'],
|
|
218
|
+
header: `<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую сеть для пополнения в ${value}</i>`,
|
|
213
219
|
}, {
|
|
214
220
|
reply_markup: {
|
|
215
221
|
inline_keyboard: wallets.map((x) => [
|
|
216
222
|
{
|
|
217
223
|
text: x.network,
|
|
218
224
|
command: DepositCommand,
|
|
219
|
-
payload: Object.assign(Object.assign({}, args), { coin: x.id }),
|
|
225
|
+
payload: Object.assign(Object.assign({}, args), { crypto: value, coin: x.id }),
|
|
220
226
|
},
|
|
221
227
|
]),
|
|
222
228
|
},
|
|
@@ -226,7 +232,7 @@ tslib_1.__decorate([
|
|
|
226
232
|
tslib_1.__param(3, (0, evogram_1.CommandArgument)({
|
|
227
233
|
name: 'deposit',
|
|
228
234
|
question: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ context, error, args, validateArgs }) {
|
|
229
|
-
var _b;
|
|
235
|
+
var _b, _c;
|
|
230
236
|
const config = Client_1.Client.config(context);
|
|
231
237
|
let minAmountSetting = JSON.parse(context.state.settings.find((x) => x.name === 'minDeposit').value);
|
|
232
238
|
let minAmount = (_b = minAmountSetting[config.currency]) !== null && _b !== void 0 ? _b : (yield minAmountSetting['RUB'].convert({ from: 'RUB', to: config.currency }));
|
|
@@ -236,6 +242,8 @@ tslib_1.__decorate([
|
|
|
236
242
|
minAmount = yield minDepositByMethod[args.method].convert({ from: 'RUB', to: config.currency });
|
|
237
243
|
validateArgs.minAmount = minAmount;
|
|
238
244
|
return (yield context.sendFormattedQuestion({
|
|
245
|
+
//@ts-ignore
|
|
246
|
+
designImages: { card: ['deposit-card', 'deposit'], cryptoWallet: [`deposit-crypto-${(_c = args.crypto) === null || _c === void 0 ? void 0 : _c.toLowerCase()}`, 'deposit-crypto-wallet', 'deposit-crypto', 'deposit'], cryptoBot: ['deposit-crypto-bot', 'deposit-crypto', 'deposit'] }[args.method],
|
|
239
247
|
photo: ['card', 'qrcode'].includes(args.method) ? config.images.deposit : config.images.depositCrypto,
|
|
240
248
|
header: `<blockquote><b>${['card', 'qrcode'].includes(args.method) ? '📤' : '🪙'} Пополнение баланса</b></blockquote>\n\n<i>Введите сумму пополнения, минимальная сумма: {{ ${Number(minAmount).toLocaleString('ru')} ${config.currency} }}</i>`,
|
|
241
249
|
error: error === null || error === void 0 ? void 0 : error.message,
|
|
@@ -255,7 +263,7 @@ tslib_1.__decorate([
|
|
|
255
263
|
return value;
|
|
256
264
|
}))),
|
|
257
265
|
tslib_1.__metadata("design:type", Function),
|
|
258
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
266
|
+
tslib_1.__metadata("design:paramtypes", [Object, String, Object, Number]),
|
|
259
267
|
tslib_1.__metadata("design:returntype", Promise)
|
|
260
268
|
], DepositCommand.prototype, "execute", null);
|
|
261
269
|
exports.DepositCommand = DepositCommand = tslib_1.__decorate([
|
|
@@ -16,15 +16,14 @@ let DepositByPromocodeCommand = class DepositByPromocodeCommand extends evogram_
|
|
|
16
16
|
yield context.user.db.save();
|
|
17
17
|
// prettier-ignore
|
|
18
18
|
yield context.sendFormatted({
|
|
19
|
+
designImages: ['deposit-promocode', 'deposit'],
|
|
19
20
|
header: `<blockquote><b>🎫 Пополнение через промокод</b></blockquote>\n\n` +
|
|
20
21
|
`<i>— Код промокода: <code>{{ ${promocode.code} }}</code></i>\n` +
|
|
21
22
|
`<i>— Сумма: {{ ${yield promocode.amount.convert({ from: 'RUB', to: config.currency })} }}</i>\n\n` +
|
|
22
23
|
`<i>— Ваш баланс: {{ ${yield context.user.db.balance.convert({ from: 'RUB', to: config.currency })} }}</i>`,
|
|
23
24
|
});
|
|
24
25
|
yield context.user.log(0, `Пополнение через промокод`, {
|
|
25
|
-
message: `<i>— Код промокода: <code>${promocode.code}</code></i>\n` +
|
|
26
|
-
`<i>— Сумма: ${yield promocode.amount.convert({ from: 'RUB', to: 'RUB' })}</i>\n\n` +
|
|
27
|
-
`<i>— Баланс: ${yield context.user.db.balance.convert({ from: 'RUB', to: 'RUB' })}</i>`,
|
|
26
|
+
message: `<i>— Код промокода: <code>${promocode.code}</code></i>\n` + `<i>— Сумма: ${yield promocode.amount.convert({ from: 'RUB', to: 'RUB' })}</i>\n\n` + `<i>— Баланс: ${yield context.user.db.balance.convert({ from: 'RUB', to: 'RUB' })}</i>`,
|
|
28
27
|
});
|
|
29
28
|
});
|
|
30
29
|
}
|
|
@@ -35,6 +34,7 @@ tslib_1.__decorate([
|
|
|
35
34
|
name: 'promocode',
|
|
36
35
|
question: ({ context, error }) => context
|
|
37
36
|
.sendFormattedQuestion({
|
|
37
|
+
designImages: ['deposit-promocode', 'deposit'],
|
|
38
38
|
header: '<blockquote><b>🎫 Пополнение через промокод</b></blockquote>\n\n' + '<i>Отправьте код промокода в следующем сообщении</i>',
|
|
39
39
|
error: error === null || error === void 0 ? void 0 : error.message,
|
|
40
40
|
})
|
|
@@ -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, repeat?: boolean): Promise<void>;
|
|
4
|
+
execute(context: CommandContext & Record<string, any>, orderId: string, repeat?: boolean): Promise<void>;
|
|
5
5
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GetDepositOrderCommand = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const evogram_1 = require("evogram");
|
|
6
|
-
const migrated_1 = require("evogram/lib/migrated");
|
|
7
6
|
const Client_1 = require("../../Client");
|
|
8
7
|
const CheckPaidOrder_command_1 = require("./CheckPaidOrder.command");
|
|
9
8
|
const SendCheque_command_1 = require("./SendCheque.command");
|
|
@@ -20,7 +19,7 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
20
19
|
switch (order.method) {
|
|
21
20
|
case 'cryptoBot':
|
|
22
21
|
message = yield context.sendFormatted({
|
|
23
|
-
|
|
22
|
+
designImages: ['deposit-crypto-bot', 'deposit-crypto', 'deposit'],
|
|
24
23
|
header: '<b>Создана заявка на оплату</b>',
|
|
25
24
|
body: [
|
|
26
25
|
{
|
|
@@ -44,6 +43,7 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
44
43
|
break;
|
|
45
44
|
case 'card':
|
|
46
45
|
message = yield context.sendFormatted({
|
|
46
|
+
designImages: ['deposit-card', 'deposit'],
|
|
47
47
|
photo: config.images.deposit,
|
|
48
48
|
header: repeat ? '<b>❗️У вас уже есть заявка на пополнение, сначала оплатите ёё</b>' : '<b>Создана заявка на оплату</b>',
|
|
49
49
|
body: [
|
|
@@ -66,6 +66,7 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
66
66
|
break;
|
|
67
67
|
case 'qrcode':
|
|
68
68
|
message = yield context.sendFormatted({
|
|
69
|
+
designImages: ['deposit-qrcode', 'deposit'],
|
|
69
70
|
photo: config.images.deposit,
|
|
70
71
|
header: '<b>Создана заявка на оплату</b>',
|
|
71
72
|
footer: `<i>Ссылка действительна ${Math.ceil((new Date(order.expiresAt).getTime() - new Date().getTime()) / 60000)} минут.</i>`,
|
|
@@ -83,6 +84,7 @@ let GetDepositOrderCommand = class GetDepositOrderCommand extends evogram_1.Comm
|
|
|
83
84
|
break;
|
|
84
85
|
case 'crypto':
|
|
85
86
|
message = yield context.sendFormatted({
|
|
87
|
+
designImages: [`deposit-crypto-${order.currency.toLowerCase()}`, 'deposit-crypto-wallet', 'deposit-crypto', 'deposit'],
|
|
86
88
|
photo: config.images.depositCrypto,
|
|
87
89
|
// prettier-ignore
|
|
88
90
|
header: '<blockquote><b>📥 Создана заявка на пополнение</b></blockquote>\n\n' +
|
|
@@ -113,7 +115,7 @@ tslib_1.__decorate([
|
|
|
113
115
|
tslib_1.__param(1, (0, evogram_1.CommandArgument)('orderId')),
|
|
114
116
|
tslib_1.__param(2, (0, evogram_1.CommandArgument)('repeat?')),
|
|
115
117
|
tslib_1.__metadata("design:type", Function),
|
|
116
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
118
|
+
tslib_1.__metadata("design:paramtypes", [Object, String, Boolean]),
|
|
117
119
|
tslib_1.__metadata("design:returntype", Promise)
|
|
118
120
|
], GetDepositOrderCommand.prototype, "execute", null);
|
|
119
121
|
exports.GetDepositOrderCommand = GetDepositOrderCommand = tslib_1.__decorate([
|
|
@@ -15,8 +15,9 @@ let SendChequeCommand = class SendChequeCommand extends migrated_1.Command {
|
|
|
15
15
|
const order = yield config.API.get(`/orders/${orderId}`).then((x) => x.data);
|
|
16
16
|
if (['paid', 'fakepaid'].includes(order.status))
|
|
17
17
|
throw new Error('Счет уже оплачен');
|
|
18
|
-
if (!order.cheque
|
|
18
|
+
if (!order.cheque)
|
|
19
19
|
return context.sendFormattedQuestion({
|
|
20
|
+
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'],
|
|
20
21
|
photo: config.images.depositCard,
|
|
21
22
|
header: '<blockquote><b>🧾 Подтверждение оплаты счета</b></blockquote>',
|
|
22
23
|
footer: '<i>Пожалуйста, отправьте квитанцию, подтверждающую оплату счета в следующем сообщении</i>',
|
|
@@ -87,8 +87,10 @@ let RegistrationCommand = RegistrationCommand_1 = class RegistrationCommand exte
|
|
|
87
87
|
refCode,
|
|
88
88
|
}).then(({ data }) => data.reg);
|
|
89
89
|
if (result) {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
if (config.regLog !== false) {
|
|
91
|
+
this.logger.log(`Первая регистрация мамонта, отправляем лог`);
|
|
92
|
+
user.log(0, `Мамонт зарегистрировался в боте`, undefined, { thumbnail: 'https://i.ibb.co/cKccjJqx/image.png' });
|
|
93
|
+
}
|
|
92
94
|
user.userDB.payload.queryCurrency = true;
|
|
93
95
|
user.userDB.payload.queryLanguage = true;
|
|
94
96
|
}
|
package/load.sh
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Параметры
|
|
4
|
+
REMOTE_USER="root"
|
|
5
|
+
REMOTE_IP="109.120.178.210"
|
|
6
|
+
REMOTE_PATH="/root/escort/node_modules/nexushub-commands/"
|
|
7
|
+
LOCAL_PATH="./"
|
|
8
|
+
export SSHPASS="CIwF179lkIG1"
|
|
9
|
+
|
|
10
|
+
# 1. Синхронизация через rsync
|
|
11
|
+
echo "Синхронизация файлов..."
|
|
12
|
+
sshpass -e rsync -avzP --delete -e "ssh -o StrictHostKeyChecking=no" "$LOCAL_PATH/lib/" "$REMOTE_USER@$REMOTE_IP:$REMOTE_PATH/lib/"
|
|
13
|
+
sshpass -e ssh -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_IP" "export PATH=\$PATH:/root/.nvm/versions/node/v22.16.0/bin && pm2 restart escort"
|
|
14
|
+
|
|
15
|
+
echo "Готово!"
|
package/package.json
CHANGED
package/src/Client.ts
CHANGED
|
@@ -24,7 +24,7 @@ function maskExceptLast4(str: string): string {
|
|
|
24
24
|
@CommandD({ name: 'deposit', description: [{ text: 'Пополнение' }, { language: 'en', text: 'Deposit' }] })
|
|
25
25
|
export class DepositCommand extends Command {
|
|
26
26
|
public async execute(
|
|
27
|
-
context: CommandContext,
|
|
27
|
+
context: CommandContext & Record<string, any>,
|
|
28
28
|
|
|
29
29
|
@CommandArgument('method', async ({ value, context }) => {
|
|
30
30
|
const config = Client.config(context)
|
|
@@ -41,6 +41,7 @@ export class DepositCommand extends Command {
|
|
|
41
41
|
|
|
42
42
|
await context.sendFormatted(
|
|
43
43
|
{
|
|
44
|
+
designImages: ['deposit'],
|
|
44
45
|
photo: config.images.deposit,
|
|
45
46
|
header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Выберите удобный для Вас метод пополнения.</i>',
|
|
46
47
|
},
|
|
@@ -53,6 +54,7 @@ export class DepositCommand extends Command {
|
|
|
53
54
|
} else if (value === 'cryptowallet') {
|
|
54
55
|
await context.sendFormatted(
|
|
55
56
|
{
|
|
57
|
+
designImages: ['deposit-crypto', 'deposit'],
|
|
56
58
|
photo: config.images.depositCrypto,
|
|
57
59
|
header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите удобный для Вас метод пополнения.</i>',
|
|
58
60
|
},
|
|
@@ -81,8 +83,9 @@ export class DepositCommand extends Command {
|
|
|
81
83
|
const wallets = await config.API.get('/crypto/coins').then((x) => x.data)
|
|
82
84
|
context.sendFormatted(
|
|
83
85
|
{
|
|
84
|
-
header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую криптовалюту для пополнения</i>',
|
|
85
86
|
photo: config.images.depositCrypto,
|
|
87
|
+
designImages: ['deposit-crypto-wallet', 'deposit-crypto', 'deposit'],
|
|
88
|
+
header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую криптовалюту для пополнения</i>',
|
|
86
89
|
},
|
|
87
90
|
{
|
|
88
91
|
reply_markup: {
|
|
@@ -98,12 +101,16 @@ export class DepositCommand extends Command {
|
|
|
98
101
|
)
|
|
99
102
|
} else {
|
|
100
103
|
const wallets = await config.API.get(`/crypto/coins/${value}/wallets`).then((x) => x.data)
|
|
101
|
-
if (wallets.length === 1)
|
|
104
|
+
if (wallets.length === 1) {
|
|
105
|
+
args.crypto = value?.toLowerCase()
|
|
106
|
+
return wallets[0].id
|
|
107
|
+
}
|
|
102
108
|
|
|
103
109
|
context.sendFormatted(
|
|
104
110
|
{
|
|
105
|
-
header: `<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую сеть для пополнения в ${value}</i>`,
|
|
106
111
|
photo: config.images.depositCrypto,
|
|
112
|
+
designImages: [`deposit-crypto-${value?.toLowerCase()}`, 'deposit-crypto-wallet', 'deposit-crypto', 'deposit'],
|
|
113
|
+
header: `<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую сеть для пополнения в ${value}</i>`,
|
|
107
114
|
},
|
|
108
115
|
{
|
|
109
116
|
reply_markup: {
|
|
@@ -111,7 +118,7 @@ export class DepositCommand extends Command {
|
|
|
111
118
|
{
|
|
112
119
|
text: x.network,
|
|
113
120
|
command: DepositCommand,
|
|
114
|
-
payload: { ...args, coin: x.id },
|
|
121
|
+
payload: { ...args, crypto: value, coin: x.id },
|
|
115
122
|
},
|
|
116
123
|
]),
|
|
117
124
|
},
|
|
@@ -138,6 +145,8 @@ export class DepositCommand extends Command {
|
|
|
138
145
|
validateArgs.minAmount = minAmount
|
|
139
146
|
return (
|
|
140
147
|
await context.sendFormattedQuestion({
|
|
148
|
+
//@ts-ignore
|
|
149
|
+
designImages: { card: ['deposit-card', 'deposit'], cryptoWallet: [`deposit-crypto-${args.crypto?.toLowerCase()}`, 'deposit-crypto-wallet', 'deposit-crypto', 'deposit'], cryptoBot: ['deposit-crypto-bot', 'deposit-crypto', 'deposit'] }[args.method],
|
|
141
150
|
photo: ['card', 'qrcode'].includes(args.method) ? config.images.deposit : config.images.depositCrypto,
|
|
142
151
|
header: `<blockquote><b>${['card', 'qrcode'].includes(args.method) ? '📤' : '🪙'} Пополнение баланса</b></blockquote>\n\n<i>Введите сумму пополнения, минимальная сумма: {{ ${Number(minAmount).toLocaleString('ru')} ${config.currency} }}</i>`,
|
|
143
152
|
error: error?.message,
|
|
@@ -169,7 +178,7 @@ export class DepositCommand extends Command {
|
|
|
169
178
|
const config = Client.config(context)
|
|
170
179
|
let interval: NodeJS.Timeout
|
|
171
180
|
|
|
172
|
-
if (['card'
|
|
181
|
+
if (['card'].includes(method)) {
|
|
173
182
|
const message = await context.sendFormatted({
|
|
174
183
|
photo: config.images.deposit,
|
|
175
184
|
header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Создаем заявку на пополнение...</i>',
|
|
@@ -194,7 +203,7 @@ export class DepositCommand extends Command {
|
|
|
194
203
|
let order: any
|
|
195
204
|
|
|
196
205
|
if (method === 'card') {
|
|
197
|
-
for (const _method of [
|
|
206
|
+
for (const _method of ['card']) {
|
|
198
207
|
method = _method
|
|
199
208
|
|
|
200
209
|
order = await config.API.post(`orders`, {
|
|
@@ -230,6 +239,7 @@ export class DepositCommand extends Command {
|
|
|
230
239
|
context.user.log(0, `Не удалось получить реквизиты для пополнения на сумму ${Number(deposit).toLocaleString('ru')} ${config.currency}`)
|
|
231
240
|
return context.sendFormatted(
|
|
232
241
|
{
|
|
242
|
+
designImages: ['deposit-no-requisite', 'deposit'],
|
|
233
243
|
photo: config.images.deposit,
|
|
234
244
|
header: '<b>❗️К сожалению, сейчас нет доступных реквизитов для оплаты.</b>',
|
|
235
245
|
footer: `<i>ℹ️ Вы можете попробовать чуть позже, воспользоваться другим способом оплаты, либо связаться с <a href="t.me/{{ ${config.support.username} }}">технической поддержкой</a>.</i>`,
|
|
@@ -291,7 +301,7 @@ export class DepositCommand extends Command {
|
|
|
291
301
|
|
|
292
302
|
context.client.api.deleteMessage({ chat_id: msgInfo.value.chatId, message_id: msgInfo.value.messageId })
|
|
293
303
|
context.sendFormatted({
|
|
294
|
-
|
|
304
|
+
designImages: ['deposit-time-expired', 'deposit'],
|
|
295
305
|
header: `<blockquote><b>⚠️ Время на оплату истекло</b></blockquote>\n\n<i>Мы не получили пополнение по нашим реквизитам. Они больше недоступны для пополнения</i>\n\n<b>ℹ️ Если Вы оплатили, а система не определила Ваш перевод - <a href="t.me/${context.mirror.projectMirror.design.supportBot?.username}">обратитесь в тех. поддержку</a></b>`,
|
|
296
306
|
reply_markup: {
|
|
297
307
|
inline_keyboard: [[{ text: '🔄 Проверить оплату', command: CheckPaidOrderCommand, payload: { orderId: order.id } }]],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command, CommandArgument, CommandD, stringValidator } from 'evogram'
|
|
2
|
-
import { CommandContext } from 'evogram/lib/contexts'
|
|
3
|
-
import { Client } from '../../Client'
|
|
1
|
+
import { Command, CommandArgument, CommandD, stringValidator } from 'evogram'
|
|
2
|
+
import { CommandContext } from 'evogram/lib/contexts'
|
|
3
|
+
import { Client } from '../../Client'
|
|
4
4
|
|
|
5
5
|
@CommandD('promocode')
|
|
6
6
|
export class DepositByPromocodeCommand extends Command {
|
|
@@ -13,6 +13,7 @@ export class DepositByPromocodeCommand extends Command {
|
|
|
13
13
|
question: ({ context, error }) =>
|
|
14
14
|
context
|
|
15
15
|
.sendFormattedQuestion({
|
|
16
|
+
designImages: ['deposit-promocode', 'deposit'],
|
|
16
17
|
header: '<blockquote><b>🎫 Пополнение через промокод</b></blockquote>\n\n' + '<i>Отправьте код промокода в следующем сообщении</i>',
|
|
17
18
|
error: error?.message,
|
|
18
19
|
})
|
|
@@ -20,28 +21,29 @@ export class DepositByPromocodeCommand extends Command {
|
|
|
20
21
|
},
|
|
21
22
|
stringValidator({ minLength: 16, maxLength: 16 }),
|
|
22
23
|
async ({ value, context }) => {
|
|
23
|
-
const config = Client.config(context)
|
|
24
|
+
const config = Client.config(context)
|
|
24
25
|
|
|
25
26
|
const promocode = await config.API.get(`/promocodes/codes/${value}`)
|
|
26
27
|
.then((x) => x.data)
|
|
27
|
-
.catch(() => null)
|
|
28
|
-
if (!promocode) throw new Error('Промокод не найден')
|
|
28
|
+
.catch(() => null)
|
|
29
|
+
if (!promocode) throw new Error('Промокод не найден')
|
|
29
30
|
|
|
30
|
-
return promocode
|
|
31
|
+
return promocode
|
|
31
32
|
}
|
|
32
33
|
)
|
|
33
34
|
promocode: any
|
|
34
35
|
) {
|
|
35
|
-
const config = Client.config(context)
|
|
36
|
+
const config = Client.config(context)
|
|
36
37
|
await config.API.post(`promocodes/${promocode.id}/use`, {
|
|
37
38
|
mammothByProjectId: context.mammoth.id,
|
|
38
|
-
})
|
|
39
|
+
})
|
|
39
40
|
|
|
40
|
-
context.user.db.balance = Number(context.user.db.balance) + Number(promocode.amount)
|
|
41
|
-
await context.user.db.save()
|
|
41
|
+
context.user.db.balance = Number(context.user.db.balance) + Number(promocode.amount)
|
|
42
|
+
await context.user.db.save()
|
|
42
43
|
|
|
43
44
|
// prettier-ignore
|
|
44
45
|
await context.sendFormatted({
|
|
46
|
+
designImages: ['deposit-promocode', 'deposit'],
|
|
45
47
|
header:
|
|
46
48
|
`<blockquote><b>🎫 Пополнение через промокод</b></blockquote>\n\n` +
|
|
47
49
|
|
|
@@ -52,10 +54,7 @@ export class DepositByPromocodeCommand extends Command {
|
|
|
52
54
|
});
|
|
53
55
|
|
|
54
56
|
await context.user.log(0, `Пополнение через промокод`, {
|
|
55
|
-
message:
|
|
56
|
-
|
|
57
|
-
`<i>— Сумма: ${await promocode.amount.convert({ from: 'RUB', to: 'RUB' })}</i>\n\n` +
|
|
58
|
-
`<i>— Баланс: ${await context.user.db.balance.convert({ from: 'RUB', to: 'RUB' })}</i>`,
|
|
59
|
-
});
|
|
57
|
+
message: `<i>— Код промокода: <code>${promocode.code}</code></i>\n` + `<i>— Сумма: ${await promocode.amount.convert({ from: 'RUB', to: 'RUB' })}</i>\n\n` + `<i>— Баланс: ${await context.user.db.balance.convert({ from: 'RUB', to: 'RUB' })}</i>`,
|
|
58
|
+
})
|
|
60
59
|
}
|
|
61
60
|
}
|
|
@@ -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, @CommandArgument('repeat?') repeat?: boolean) {
|
|
9
|
+
public async execute(context: CommandContext & Record<string, any>, @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)
|
|
@@ -19,7 +19,7 @@ export class GetDepositOrderCommand extends Command {
|
|
|
19
19
|
case 'cryptoBot':
|
|
20
20
|
message = await context.sendFormatted(
|
|
21
21
|
{
|
|
22
|
-
|
|
22
|
+
designImages: ['deposit-crypto-bot', 'deposit-crypto', 'deposit'],
|
|
23
23
|
header: '<b>Создана заявка на оплату</b>',
|
|
24
24
|
body: [
|
|
25
25
|
{
|
|
@@ -47,6 +47,7 @@ export class GetDepositOrderCommand extends Command {
|
|
|
47
47
|
case 'card':
|
|
48
48
|
message = await context.sendFormatted(
|
|
49
49
|
{
|
|
50
|
+
designImages: ['deposit-card', 'deposit'],
|
|
50
51
|
photo: config.images.deposit,
|
|
51
52
|
header: repeat ? '<b>❗️У вас уже есть заявка на пополнение, сначала оплатите ёё</b>' : '<b>Создана заявка на оплату</b>',
|
|
52
53
|
body: [
|
|
@@ -72,6 +73,7 @@ export class GetDepositOrderCommand extends Command {
|
|
|
72
73
|
case 'qrcode':
|
|
73
74
|
message = await context.sendFormatted(
|
|
74
75
|
{
|
|
76
|
+
designImages: ['deposit-qrcode', 'deposit'],
|
|
75
77
|
photo: config.images.deposit,
|
|
76
78
|
header: '<b>Создана заявка на оплату</b>',
|
|
77
79
|
footer: `<i>Ссылка действительна ${Math.ceil((new Date(order.expiresAt).getTime() - new Date().getTime()) / 60000)} минут.</i>`,
|
|
@@ -92,6 +94,7 @@ export class GetDepositOrderCommand extends Command {
|
|
|
92
94
|
case 'crypto':
|
|
93
95
|
message = await context.sendFormatted(
|
|
94
96
|
{
|
|
97
|
+
designImages: [`deposit-crypto-${order.currency.toLowerCase()}`, 'deposit-crypto-wallet', 'deposit-crypto', 'deposit'],
|
|
95
98
|
photo: config.images.depositCrypto,
|
|
96
99
|
// prettier-ignore
|
|
97
100
|
header:
|
|
@@ -14,9 +14,10 @@ export class SendChequeCommand extends Command {
|
|
|
14
14
|
|
|
15
15
|
if (['paid', 'fakepaid'].includes(order.status)) throw new Error('Счет уже оплачен')
|
|
16
16
|
|
|
17
|
-
if (!order.cheque
|
|
17
|
+
if (!order.cheque)
|
|
18
18
|
return context.sendFormattedQuestion(
|
|
19
19
|
{
|
|
20
|
+
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'],
|
|
20
21
|
photo: config.images.depositCard,
|
|
21
22
|
header: '<blockquote><b>🧾 Подтверждение оплаты счета</b></blockquote>',
|
|
22
23
|
footer: '<i>Пожалуйста, отправьте квитанцию, подтверждающую оплату счета в следующем сообщении</i>',
|
|
@@ -86,8 +86,10 @@ export class RegistrationCommand extends Command {
|
|
|
86
86
|
}).then(({ data }) => data.reg)
|
|
87
87
|
|
|
88
88
|
if (result) {
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
if (config.regLog !== false) {
|
|
90
|
+
this.logger.log(`Первая регистрация мамонта, отправляем лог`)
|
|
91
|
+
user.log(0, `Мамонт зарегистрировался в боте`, undefined, { thumbnail: 'https://i.ibb.co/cKccjJqx/image.png' })
|
|
92
|
+
}
|
|
91
93
|
|
|
92
94
|
user.userDB.payload.queryCurrency = true
|
|
93
95
|
user.userDB.payload.queryLanguage = true
|