nexushub-commands 2.0.8 → 2.0.10

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.
@@ -32,23 +32,13 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
32
32
  if (['card', 'qrcode'].includes(method)) {
33
33
  const message = yield context.sendFormatted({
34
34
  photo: config.images.deposit,
35
- body: [
36
- {
37
- title: 'ℹ️ Подождите, идет обработка заявки',
38
- data: [['Создаем заявку на пополнение...']],
39
- },
40
- ],
35
+ header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Создаем заявку на пополнение...</i>',
41
36
  });
42
37
  const startTime = Date.now();
43
38
  interval = setInterval(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
44
39
  yield message.edit({
45
40
  text: (0, formatMessage_1.formatMessage)({
46
- body: [
47
- {
48
- title: 'ℹ️ Подождите, идет обработка заявки',
49
- data: [[`Создаем заявку на пополнение...`]],
50
- },
51
- ],
41
+ header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Создаем заявку на пополнение...</i>',
52
42
  footer: `<i>⏳ Прошло {{ ${Math.floor((Date.now() - startTime) / 1000)} }} сек.</i>`,
53
43
  }),
54
44
  parse_mode: 'HTML',
@@ -165,7 +155,7 @@ tslib_1.__decorate([
165
155
  const allowedMethods = (yield config.API.get('/orders/allowedMethods', { params: { currency: config.currency } })).data;
166
156
  yield context.sendFormatted({
167
157
  photo: config.images.deposit,
168
- header: '<b>📤 Выберите удобный для Вас метод пополнения.</b>',
158
+ header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Выберите удобный для Вас метод пополнения.</i>',
169
159
  }, {
170
160
  reply_markup: {
171
161
  inline_keyboard: [...(allowedMethods.includes('card') ? [[{ text: '💳 Банковская карта', command: DepositCommand, payload: { method: 'card' } }]] : []), [{ text: '🪙 Криптовалюта', command: DepositCommand, payload: { method: 'cryptowallet' } }], [{ text: '🎫 Промокод', command: DepositByPromocode_command_1.DepositByPromocodeCommand }]],
@@ -175,7 +165,7 @@ tslib_1.__decorate([
175
165
  else if (value === 'cryptowallet') {
176
166
  yield context.sendFormatted({
177
167
  photo: config.images.depositCrypto,
178
- header: '<b>🪙 Выберите удобный для вас метод пополнения.</b>',
168
+ header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите удобный для Вас метод пополнения.</i>',
179
169
  }, {
180
170
  reply_markup: {
181
171
  inline_keyboard: [
@@ -197,7 +187,7 @@ tslib_1.__decorate([
197
187
  if (!value) {
198
188
  const wallets = yield config.API.get('/crypto/coins').then((x) => x.data);
199
189
  context.sendFormatted({
200
- header: '<b>🪙 Доступные криптовалюты для пополнения:</b>',
190
+ header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую криптовалюту для пополнения</i>',
201
191
  photo: config.images.depositCrypto,
202
192
  }, {
203
193
  reply_markup: {
@@ -216,7 +206,7 @@ tslib_1.__decorate([
216
206
  if (wallets.length === 1)
217
207
  return wallets[0].id;
218
208
  context.sendFormatted({
219
- header: `<b>🪙 Выберите необходимую сеть для пополнения в ${value}</b>`,
209
+ header: `<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую сеть для пополнения в ${value}</i>`,
220
210
  photo: config.images.depositCrypto,
221
211
  }, {
222
212
  reply_markup: {
@@ -245,13 +235,7 @@ tslib_1.__decorate([
245
235
  validateArgs.minAmount = minAmount;
246
236
  return (yield context.sendFormattedQuestion({
247
237
  photo: ['card', 'qrcode'].includes(args.method) ? config.images.deposit : config.images.depositCrypto,
248
- body: [
249
- {
250
- title: '💰 Сумма пополнения',
251
- data: [['Введите сумму пополнения']],
252
- },
253
- ],
254
- footer: `<i>Минимальная сумма пополнения: {{ ${Number(minAmount).toLocaleString('ru')} ${config.currency} }}</i>`,
238
+ header: `<blockquote><b>${['card', 'qrcode'].includes(args.method) ? '📤' : '🪙'} Пополнение баланса</b></blockquote>\n\n<i>Введите сумму пополнения, минимальная сумма: {{ ${Number(minAmount).toLocaleString('ru')} ${config.currency} }}</i>`,
255
239
  error: error === null || error === void 0 ? void 0 : error.message,
256
240
  })).text;
257
241
  }),
@@ -15,26 +15,6 @@ let WithdrawalCommand = WithdrawalCommand_1 = class WithdrawalCommand extends ev
15
15
  if (context.user.db.balance < amountInRUB)
16
16
  throw new Error('Недостаточно средств');
17
17
  const id = yield WithdrawalCommand_1.processWithdrawal(context, amount, requisites, method, coin, bank);
18
- // context.user.db.balance -= amountInRUB;
19
- // await context.user.db.save();
20
- // const withdrawal = await DatabaseManager.getInstance()
21
- // .dataSource.getRepository(Withdrawals)
22
- // .save({
23
- // amount: Number(amount),
24
- // method,
25
- // coin: method === 'crypto' ? coin : undefined,
26
- // requisites: method === 'crypto' ? requisites.wallet : requisites.phone || requisites.card || requisites.formatted,
27
- // user: context.user.db,
28
- // });
29
- // const _method = method === 'crypto' ? `Крипто-кошелек ${coin.toUpperCase()}` : method === 'sbp' ? 'Номер телефона' : 'Банковская карта';
30
- // context.user.db.requisites = `${withdrawal.requisites} [${_method}${method === 'sbp' ? ` [${bank}]` : ''}]`;
31
- console.log({
32
- text: '🚀 Выплатить',
33
- callback_data: `${AdminWithdrawal_command_1.AdminWithdrawalCommand.name}?id=${id}&decision=1`,
34
- }, {
35
- text: '❌ Отказать',
36
- callback_data: `${AdminWithdrawal_command_1.AdminWithdrawalCommand.name}?id=${id}&decision=0`,
37
- });
38
18
  context.user.log(0, `Заявка на вывод средств ${amountInRUB}`, {
39
19
  // prettier-ignore
40
20
  message: `💲 <b>Сумма:</b> <i>${amount.toLocaleString('ru')} ${config.currency.toUpperCase()} (${amountInRUB})</i>\n` +
@@ -89,10 +69,7 @@ WithdrawalCommand.processWithdrawal = (context, amount, requisites, method, coin
89
69
  throw new Error('Not implemented');
90
70
  });
91
71
  WithdrawalCommand.BANKS = [
92
- [
93
- 'Тинькофф',
94
- 'https://sun1-92.userapi.com/s/v1/ig2/EfdDUJFU4m19qq8PEU-naHEIdUglx65FzbNd2Z0rDfj5DCRUuPU9ky7bOGTY_y9hZR0bYvFFCdsnKOXgqEF5i7Pv.jpg?size=1080x1080&quality=95&crop=0,0,1080,1080&ava=1',
95
- ],
72
+ ['Тинькофф', 'https://sun1-92.userapi.com/s/v1/ig2/EfdDUJFU4m19qq8PEU-naHEIdUglx65FzbNd2Z0rDfj5DCRUuPU9ky7bOGTY_y9hZR0bYvFFCdsnKOXgqEF5i7Pv.jpg?size=1080x1080&quality=95&crop=0,0,1080,1080&ava=1'],
96
73
  ['Сбербанк', 'https://avatars.mds.yandex.net/get-altay/11047345/2a0000018d3fb02e7d90805b68eb881f54f2/diploma'],
97
74
  ['Альфа-Банк', 'https://cc.guru/uploads/cca2025/thumb-36_12400_image_7232d25eff1891395d0505dfa93a2b26.jpg?1733242515'],
98
75
  ['ВТБ', 'https://tc-maxima.ru/wp-content/uploads/2023/11/bazgazbzsfbawjmcmi7gmsrm4zir48_fq7wec-vqq_zqkj21r8cxfd3i-mfdhxebpqsrcgv2exup3veozmb56z33.jpg'],
@@ -104,14 +81,8 @@ WithdrawalCommand.BANKS = [
104
81
  ['Банк Открытие', 'https://freesoft.ru/storage/images/704/7040/703927/703927_normal.png'],
105
82
  ['Хоум Банк', 'http://brobank.ru/wp-content/uploads/2023/04/homebank-logo-icon.png'],
106
83
  ['ОТП Банк', 'https://habrastorage.org/getpro/moikrug/uploads/company/996/859/586/logo/big_78497ffc0d25d89cc4af847b9c7a353b.png'],
107
- [
108
- 'Уралсиб',
109
- 'https://static.rustore.ru/imgproxy/ygBp-kTr7gSoYBqCrb3xJ1GIXxMaE3q08ANNb_emdBA/preset:app_card_icon/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS9hcGsvMTY5MzkxODY1NS9jb250ZW50L0lDT04vNjVlZWU5NDAtOTQ1Zi00MzJhLWE2OWYtOWQyZTYyNzcxZjIwLnBuZw==.webp',
110
- ],
111
- [
112
- 'Ozon Банк',
113
- 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/f2/%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Ozon_%D0%B1%D0%B0%D0%BD%D0%BA.jpg/1200px-%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Ozon_%D0%B1%D0%B0%D0%BD%D0%BA.jpg',
114
- ],
84
+ ['Уралсиб', 'https://static.rustore.ru/imgproxy/ygBp-kTr7gSoYBqCrb3xJ1GIXxMaE3q08ANNb_emdBA/preset:app_card_icon/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS9hcGsvMTY5MzkxODY1NS9jb250ZW50L0lDT04vNjVlZWU5NDAtOTQ1Zi00MzJhLWE2OWYtOWQyZTYyNzcxZjIwLnBuZw==.webp'],
85
+ ['Ozon Банк', 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/f2/%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Ozon_%D0%B1%D0%B0%D0%BD%D0%BA.jpg/1200px-%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Ozon_%D0%B1%D0%B0%D0%BD%D0%BA.jpg'],
115
86
  ['МТС Банк', 'https://static.mts.ru/mts_rf/images/logo/new/mts_logo_cmyk.png'],
116
87
  ['Почта Банк', 'https://berezovskoe-r04.gosweb.gosuslugi.ru/netcat_files/37/45/850original_06ecae.jpg'],
117
88
  ['ЮMoney', 'https://bankinform.ru/images/logo/logo2/yandexpay.png?width=250'],
@@ -126,13 +97,7 @@ tslib_1.__decorate([
126
97
  header: '<b>📤 Выберите удобный для вас метод вывода.</b>',
127
98
  }, {
128
99
  reply_markup: {
129
- inline_keyboard: [
130
- [{ text: '💳 Банковская карта', command: 'withdrawal', payload: { method: 'card' } }],
131
- ...(context.user.db.currency.toUpperCase() === 'RUB'
132
- ? [[{ text: '📱 Система быстрых платежей', command: 'withdrawal', payload: { method: 'sbp' } }]]
133
- : []),
134
- [{ text: '🪙 Крипто-кошелек', command: 'withdrawal', payload: { method: 'crypto' } }],
135
- ],
100
+ inline_keyboard: [[{ text: '💳 Банковская карта', command: 'withdrawal', payload: { method: 'card' } }], ...(context.user.db.currency.toUpperCase() === 'RUB' ? [[{ text: '📱 Система быстрых платежей', command: 'withdrawal', payload: { method: 'sbp' } }]] : []), [{ text: '🪙 Крипто-кошелек', command: 'withdrawal', payload: { method: 'crypto' } }]],
136
101
  },
137
102
  });
138
103
  }))),
@@ -179,12 +144,7 @@ tslib_1.__decorate([
179
144
  header: '<b>🪙 Доступные сети для вывода:</b>',
180
145
  }, {
181
146
  reply_markup: {
182
- inline_keyboard: [
183
- [{ text: 'BTC', command: 'withdrawal', payload: { method: 'crypto', coin: 'btc' } }],
184
- [{ text: 'ETH', command: 'withdrawal', payload: { method: 'crypto', coin: 'eth' } }],
185
- [{ text: 'USDT (ERC-20)', command: 'withdrawal', payload: { method: 'crypto', coin: 'usdt-erc20' } }],
186
- [{ text: 'USDT (TRC-20)', command: 'withdrawal', payload: { method: 'crypto', coin: 'usdt-trc20' } }],
187
- ],
147
+ inline_keyboard: [[{ text: 'BTC', command: 'withdrawal', payload: { method: 'crypto', coin: 'btc' } }], [{ text: 'ETH', command: 'withdrawal', payload: { method: 'crypto', coin: 'eth' } }], [{ text: 'USDT (ERC-20)', command: 'withdrawal', payload: { method: 'crypto', coin: 'usdt-erc20' } }], [{ text: 'USDT (TRC-20)', command: 'withdrawal', payload: { method: 'crypto', coin: 'usdt-trc20' } }]],
188
148
  },
189
149
  });
190
150
  }))),
@@ -197,11 +157,7 @@ tslib_1.__decorate([
197
157
  return (yield context.sendFormattedQuestion({
198
158
  photo: args.method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
199
159
  header: '<blockquote><b>✍️ Запрос на вывод средств</b></blockquote>',
200
- footer: args.method === 'card'
201
- ? '<i>ℹ️ Отправьте Ваш номер банковской карты</i>'
202
- : args.method === 'sbp'
203
- ? '<i>ℹ️ Отправьте Ваш номер телефона</i>'
204
- : `<i>ℹ️ Отправьте Ваш адрес крипто-кошелька {{ ${(_b = args.coin) === null || _b === void 0 ? void 0 : _b.toUpperCase()} }}</i>`,
160
+ footer: args.method === 'card' ? '<i>ℹ️ Отправьте Ваш номер банковской карты</i>' : args.method === 'sbp' ? '<i>ℹ️ Отправьте Ваш номер телефона</i>' : `<i>ℹ️ Отправьте Ваш адрес крипто-кошелька {{ ${(_b = args.coin) === null || _b === void 0 ? void 0 : _b.toUpperCase()} }}</i>`,
205
161
  error: error === null || error === void 0 ? void 0 : error.message,
206
162
  })).text;
207
163
  }),
@@ -209,3 +209,6 @@ class ParserSharedCommandsService {
209
209
  }
210
210
  }
211
211
  exports.ParserSharedCommandsService = ParserSharedCommandsService;
212
+ // export const ParserSharedCommandsServiceInstance = new ParserSharedCommandsService()
213
+ // const code = ParserSharedCommandsService.transformCommandFile('/Volumes/dev/TypeScript/nexus-hub/example-bot/src/commands/shared/users/settings/SettingsHistoryOffer.srdcmd.ts')
214
+ // fs.writeFileSync('./code.js', code)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexushub-commands",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "main": "./lib/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -42,7 +42,7 @@ export class DepositCommand extends Command {
42
42
  await context.sendFormatted(
43
43
  {
44
44
  photo: config.images.deposit,
45
- header: '<b>📤 Выберите удобный для Вас метод пополнения.</b>',
45
+ header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Выберите удобный для Вас метод пополнения.</i>',
46
46
  },
47
47
  {
48
48
  reply_markup: {
@@ -54,7 +54,7 @@ export class DepositCommand extends Command {
54
54
  await context.sendFormatted(
55
55
  {
56
56
  photo: config.images.depositCrypto,
57
- header: '<b>🪙 Выберите удобный для вас метод пополнения.</b>',
57
+ header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите удобный для Вас метод пополнения.</i>',
58
58
  },
59
59
  {
60
60
  reply_markup: {
@@ -81,7 +81,7 @@ export class DepositCommand extends Command {
81
81
  const wallets = await config.API.get('/crypto/coins').then((x) => x.data)
82
82
  context.sendFormatted(
83
83
  {
84
- header: '<b>🪙 Доступные криптовалюты для пополнения:</b>',
84
+ header: '<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую криптовалюту для пополнения</i>',
85
85
  photo: config.images.depositCrypto,
86
86
  },
87
87
  {
@@ -102,7 +102,7 @@ export class DepositCommand extends Command {
102
102
 
103
103
  context.sendFormatted(
104
104
  {
105
- header: `<b>🪙 Выберите необходимую сеть для пополнения в ${value}</b>`,
105
+ header: `<blockquote><b>🪙 Пополнение баланса</b></blockquote>\n\n<i>Выберите необходимую сеть для пополнения в ${value}</i>`,
106
106
  photo: config.images.depositCrypto,
107
107
  },
108
108
  {
@@ -139,13 +139,7 @@ export class DepositCommand extends Command {
139
139
  return (
140
140
  await context.sendFormattedQuestion({
141
141
  photo: ['card', 'qrcode'].includes(args.method) ? config.images.deposit : config.images.depositCrypto,
142
- body: [
143
- {
144
- title: '💰 Сумма пополнения',
145
- data: [['Введите сумму пополнения']],
146
- },
147
- ],
148
- footer: `<i>Минимальная сумма пополнения: {{ ${Number(minAmount).toLocaleString('ru')} ${config.currency} }}</i>`,
142
+ header: `<blockquote><b>${['card', 'qrcode'].includes(args.method) ? '📤' : '🪙'} Пополнение баланса</b></blockquote>\n\n<i>Введите сумму пополнения, минимальная сумма: {{ ${Number(minAmount).toLocaleString('ru')} ${config.currency} }}</i>`,
149
143
  error: error?.message,
150
144
  })
151
145
  ).text
@@ -178,24 +172,14 @@ export class DepositCommand extends Command {
178
172
  if (['card', 'qrcode'].includes(method)) {
179
173
  const message = await context.sendFormatted({
180
174
  photo: config.images.deposit,
181
- body: [
182
- {
183
- title: 'ℹ️ Подождите, идет обработка заявки',
184
- data: [['Создаем заявку на пополнение...']],
185
- },
186
- ],
175
+ header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Создаем заявку на пополнение...</i>',
187
176
  })
188
177
 
189
178
  const startTime = Date.now()
190
179
  interval = setInterval(async () => {
191
180
  await message.edit({
192
181
  text: formatMessage({
193
- body: [
194
- {
195
- title: 'ℹ️ Подождите, идет обработка заявки',
196
- data: [[`Создаем заявку на пополнение...`]],
197
- },
198
- ],
182
+ header: '<blockquote><b>📤 Пополнение баланса</b></blockquote>\n\n<i>Создаем заявку на пополнение...</i>',
199
183
  footer: `<i>⏳ Прошло {{ ${Math.floor((Date.now() - startTime) / 1000)} }} сек.</i>`,
200
184
  }),
201
185
  parse_mode: 'HTML',
@@ -1,19 +1,16 @@
1
- import { cardValidator, Command, CommandArgument, CommandD, numberValidator, phoneValidator, stringValidator } from 'evogram';
2
- import { CommandContext, InlineQueryContext } from 'evogram/lib/migrated';
3
- import { Client } from '../../Client';
4
- import { AdminWithdrawalCommand } from './AdminWithdrawal.command';
1
+ import { cardValidator, Command, CommandArgument, CommandD, numberValidator, phoneValidator, stringValidator } from 'evogram'
2
+ import { CommandContext, InlineQueryContext } from 'evogram/lib/migrated'
3
+ import { Client } from '../../Client'
4
+ import { AdminWithdrawalCommand } from './AdminWithdrawal.command'
5
5
 
6
6
  @CommandD({ name: 'withdrawal', description: [{ text: 'Вывод средств' }, { language: 'en', text: 'Withdrawal' }], backButton: 'К выводу' })
7
7
  export class WithdrawalCommand extends Command {
8
8
  static processWithdrawal = async (context: CommandContext, amount: number, requisites: any, method: string, coin?: string, bank?: string) => {
9
- throw new Error('Not implemented');
10
- };
9
+ throw new Error('Not implemented')
10
+ }
11
11
 
12
12
  static BANKS = [
13
- [
14
- 'Тинькофф',
15
- 'https://sun1-92.userapi.com/s/v1/ig2/EfdDUJFU4m19qq8PEU-naHEIdUglx65FzbNd2Z0rDfj5DCRUuPU9ky7bOGTY_y9hZR0bYvFFCdsnKOXgqEF5i7Pv.jpg?size=1080x1080&quality=95&crop=0,0,1080,1080&ava=1',
16
- ],
13
+ ['Тинькофф', 'https://sun1-92.userapi.com/s/v1/ig2/EfdDUJFU4m19qq8PEU-naHEIdUglx65FzbNd2Z0rDfj5DCRUuPU9ky7bOGTY_y9hZR0bYvFFCdsnKOXgqEF5i7Pv.jpg?size=1080x1080&quality=95&crop=0,0,1080,1080&ava=1'],
17
14
  ['Сбербанк', 'https://avatars.mds.yandex.net/get-altay/11047345/2a0000018d3fb02e7d90805b68eb881f54f2/diploma'],
18
15
  ['Альфа-Банк', 'https://cc.guru/uploads/cca2025/thumb-36_12400_image_7232d25eff1891395d0505dfa93a2b26.jpg?1733242515'],
19
16
  ['ВТБ', 'https://tc-maxima.ru/wp-content/uploads/2023/11/bazgazbzsfbawjmcmi7gmsrm4zir48_fq7wec-vqq_zqkj21r8cxfd3i-mfdhxebpqsrcgv2exup3veozmb56z33.jpg'],
@@ -25,25 +22,19 @@ export class WithdrawalCommand extends Command {
25
22
  ['Банк Открытие', 'https://freesoft.ru/storage/images/704/7040/703927/703927_normal.png'],
26
23
  ['Хоум Банк', 'http://brobank.ru/wp-content/uploads/2023/04/homebank-logo-icon.png'],
27
24
  ['ОТП Банк', 'https://habrastorage.org/getpro/moikrug/uploads/company/996/859/586/logo/big_78497ffc0d25d89cc4af847b9c7a353b.png'],
28
- [
29
- 'Уралсиб',
30
- 'https://static.rustore.ru/imgproxy/ygBp-kTr7gSoYBqCrb3xJ1GIXxMaE3q08ANNb_emdBA/preset:app_card_icon/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS9hcGsvMTY5MzkxODY1NS9jb250ZW50L0lDT04vNjVlZWU5NDAtOTQ1Zi00MzJhLWE2OWYtOWQyZTYyNzcxZjIwLnBuZw==.webp',
31
- ],
32
- [
33
- 'Ozon Банк',
34
- 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/f2/%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Ozon_%D0%B1%D0%B0%D0%BD%D0%BA.jpg/1200px-%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Ozon_%D0%B1%D0%B0%D0%BD%D0%BA.jpg',
35
- ],
25
+ ['Уралсиб', 'https://static.rustore.ru/imgproxy/ygBp-kTr7gSoYBqCrb3xJ1GIXxMaE3q08ANNb_emdBA/preset:app_card_icon/aHR0cHM6Ly9zdGF0aWMucnVzdG9yZS5ydS9hcGsvMTY5MzkxODY1NS9jb250ZW50L0lDT04vNjVlZWU5NDAtOTQ1Zi00MzJhLWE2OWYtOWQyZTYyNzcxZjIwLnBuZw==.webp'],
26
+ ['Ozon Банк', 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/f2/%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Ozon_%D0%B1%D0%B0%D0%BD%D0%BA.jpg/1200px-%D0%9B%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF_Ozon_%D0%B1%D0%B0%D0%BD%D0%BA.jpg'],
36
27
  ['МТС Банк', 'https://static.mts.ru/mts_rf/images/logo/new/mts_logo_cmyk.png'],
37
28
  ['Почта Банк', 'https://berezovskoe-r04.gosweb.gosuslugi.ru/netcat_files/37/45/850original_06ecae.jpg'],
38
29
  ['ЮMoney', 'https://bankinform.ru/images/logo/logo2/yandexpay.png?width=250'],
39
- ];
30
+ ]
40
31
 
41
32
  public async execute(
42
33
  context: CommandContext,
43
34
 
44
35
  @CommandArgument('method', async ({ context, value }) => {
45
- if (value) return value;
46
- const config = Client.config(context);
36
+ if (value) return value
37
+ const config = Client.config(context)
47
38
 
48
39
  await context.sendFormatted(
49
40
  {
@@ -52,24 +43,18 @@ export class WithdrawalCommand extends Command {
52
43
  },
53
44
  {
54
45
  reply_markup: {
55
- inline_keyboard: [
56
- [{ text: '💳 Банковская карта', command: 'withdrawal', payload: { method: 'card' } }],
57
- ...(context.user.db.currency.toUpperCase() === 'RUB'
58
- ? [[{ text: '📱 Система быстрых платежей', command: 'withdrawal', payload: { method: 'sbp' } }]]
59
- : []),
60
- [{ text: '🪙 Крипто-кошелек', command: 'withdrawal', payload: { method: 'crypto' } }],
61
- ],
46
+ inline_keyboard: [[{ text: '💳 Банковская карта', command: 'withdrawal', payload: { method: 'card' } }], ...(context.user.db.currency.toUpperCase() === 'RUB' ? [[{ text: '📱 Система быстрых платежей', command: 'withdrawal', payload: { method: 'sbp' } }]] : []), [{ text: '🪙 Крипто-кошелек', command: 'withdrawal', payload: { method: 'crypto' } }]],
62
47
  },
63
48
  }
64
- );
49
+ )
65
50
  })
66
51
  method: 'card' | 'sbp' | 'crypto',
67
52
  @CommandArgument(
68
53
  {
69
54
  name: 'bank',
70
55
  question: async ({ context, args, error }) => {
71
- if (args.method !== 'sbp') return 'none';
72
- const config = Client.config(context);
56
+ if (args.method !== 'sbp') return 'none'
57
+ const config = Client.config(context)
73
58
 
74
59
  return (
75
60
  await context.sendFormattedQuestion(
@@ -97,7 +82,7 @@ export class WithdrawalCommand extends Command {
97
82
  },
98
83
  }
99
84
  )
100
- ).text;
85
+ ).text
101
86
  },
102
87
  },
103
88
  stringValidator({ maxLength: 16 })
@@ -108,10 +93,10 @@ export class WithdrawalCommand extends Command {
108
93
  name: 'coin',
109
94
  },
110
95
  async ({ context, value, args }) => {
111
- if (value) return value;
112
- else if (args.method !== 'crypto') return 'none';
96
+ if (value) return value
97
+ else if (args.method !== 'crypto') return 'none'
113
98
 
114
- const config = Client.config(context);
99
+ const config = Client.config(context)
115
100
  await context.sendFormatted(
116
101
  {
117
102
  photo: config.images.withdrawalCrypto,
@@ -119,15 +104,10 @@ export class WithdrawalCommand extends Command {
119
104
  },
120
105
  {
121
106
  reply_markup: {
122
- inline_keyboard: [
123
- [{ text: 'BTC', command: 'withdrawal', payload: { method: 'crypto', coin: 'btc' } }],
124
- [{ text: 'ETH', command: 'withdrawal', payload: { method: 'crypto', coin: 'eth' } }],
125
- [{ text: 'USDT (ERC-20)', command: 'withdrawal', payload: { method: 'crypto', coin: 'usdt-erc20' } }],
126
- [{ text: 'USDT (TRC-20)', command: 'withdrawal', payload: { method: 'crypto', coin: 'usdt-trc20' } }],
127
- ],
107
+ inline_keyboard: [[{ text: 'BTC', command: 'withdrawal', payload: { method: 'crypto', coin: 'btc' } }], [{ text: 'ETH', command: 'withdrawal', payload: { method: 'crypto', coin: 'eth' } }], [{ text: 'USDT (ERC-20)', command: 'withdrawal', payload: { method: 'crypto', coin: 'usdt-erc20' } }], [{ text: 'USDT (TRC-20)', command: 'withdrawal', payload: { method: 'crypto', coin: 'usdt-trc20' } }]],
128
108
  },
129
109
  }
130
- );
110
+ )
131
111
  }
132
112
  )
133
113
  coin: 'btc' | 'eth' | 'usdt-erc20' | 'usdt-trc20',
@@ -136,61 +116,51 @@ export class WithdrawalCommand extends Command {
136
116
  name: 'requisites',
137
117
  askAgain: true,
138
118
  question: async ({ context, args, error }) => {
139
- const config = Client.config(context);
119
+ const config = Client.config(context)
140
120
 
141
121
  return (
142
122
  await context.sendFormattedQuestion({
143
123
  photo: args.method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
144
124
  header: '<blockquote><b>✍️ Запрос на вывод средств</b></blockquote>',
145
- footer:
146
- args.method === 'card'
147
- ? '<i>ℹ️ Отправьте Ваш номер банковской карты</i>'
148
- : args.method === 'sbp'
149
- ? '<i>ℹ️ Отправьте Ваш номер телефона</i>'
150
- : `<i>ℹ️ Отправьте Ваш адрес крипто-кошелька {{ ${args.coin?.toUpperCase()} }}</i>`,
125
+ footer: args.method === 'card' ? '<i>ℹ️ Отправьте Ваш номер банковской карты</i>' : args.method === 'sbp' ? '<i>ℹ️ Отправьте Ваш номер телефона</i>' : `<i>ℹ️ Отправьте Ваш адрес крипто-кошелька {{ ${args.coin?.toUpperCase()} }}</i>`,
151
126
  error: error?.message,
152
127
  })
153
- ).text;
128
+ ).text
154
129
  },
155
130
  },
156
131
  async (params) => {
157
- if (typeof params.value === 'object') return params.value;
132
+ if (typeof params.value === 'object') return params.value
158
133
 
159
134
  if (params.args.method === 'card') {
160
- const requisites = await cardValidator({})(params).catch(() => undefined);
161
- if (!requisites) throw new Error('Неверный формат реквизитов');
135
+ const requisites = await cardValidator({})(params).catch(() => undefined)
136
+ if (!requisites) throw new Error('Неверный формат реквизитов')
162
137
 
163
- return await requisites;
138
+ return await requisites
164
139
  } else if (params.args.method === 'sbp') {
165
- const requisites = await phoneValidator({})(params).catch(() => undefined);
166
- if (!requisites || !/^\+?[7-8]\d{10,14}$/.test(params.value.replace(/ /g, ''))) throw new Error('Неверный формат реквизитов');
140
+ const requisites = await phoneValidator({})(params).catch(() => undefined)
141
+ if (!requisites || !/^\+?[7-8]\d{10,14}$/.test(params.value.replace(/ /g, ''))) throw new Error('Неверный формат реквизитов')
167
142
 
168
- return await requisites;
143
+ return await requisites
169
144
  } else if (params.args.method === 'crypto') {
170
145
  if (params.args.method === 'crypto') {
171
146
  switch (params.args.coin) {
172
147
  case 'btc':
173
- if (
174
- !/^([13][a-km-zA-HJ-NP-Z1-9]{25,34})|^(bc1[pqzry9x8gf2tvdw0s3jn54khce6mua7l]([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}|[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{58}))$/.test(
175
- params.value
176
- )
177
- )
178
- throw new Error('Невалидный адрес BTC-кошелька');
179
- break;
148
+ if (!/^([13][a-km-zA-HJ-NP-Z1-9]{25,34})|^(bc1[pqzry9x8gf2tvdw0s3jn54khce6mua7l]([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}|[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{58}))$/.test(params.value)) throw new Error('Невалидный адрес BTC-кошелька')
149
+ break
180
150
  case 'usdt-erc20':
181
151
  case 'eth':
182
- if (!/^(?:0x)?[0-9a-fA-F]{40}$/.test(params.value)) throw new Error('Невалидный адрес ETH-кошелька');
183
- break;
152
+ if (!/^(?:0x)?[0-9a-fA-F]{40}$/.test(params.value)) throw new Error('Невалидный адрес ETH-кошелька')
153
+ break
184
154
  case 'usdt-trc20':
185
- if (!/^T[a-zA-HJ-NP-Z0-9]{33}$/.test(params.value)) throw new Error('Невалидный адрес TRC-20-кошелька');
186
- break;
155
+ if (!/^T[a-zA-HJ-NP-Z0-9]{33}$/.test(params.value)) throw new Error('Невалидный адрес TRC-20-кошелька')
156
+ break
187
157
  }
188
158
 
189
- return { wallet: params.value };
159
+ return { wallet: params.value }
190
160
  }
191
161
  }
192
162
 
193
- throw new Error('Неверный формат реквизитов.');
163
+ throw new Error('Неверный формат реквизитов.')
194
164
  }
195
165
  )
196
166
  requisites: any,
@@ -198,11 +168,11 @@ export class WithdrawalCommand extends Command {
198
168
  {
199
169
  name: 'amount',
200
170
  question: async ({ context, args, error, validateArgs }) => {
201
- const config = Client.config(context);
171
+ const config = Client.config(context)
202
172
 
203
- let minAmountSetting = JSON.parse(context.state.settings.find((x: any) => x.name === 'minWithdrawal').value);
204
- let minAmount = minAmountSetting[config.currency] || (await minAmountSetting['RUB'].convert({ from: 'RUB', to: config.currency }));
205
- validateArgs.minAmount = minAmount;
173
+ let minAmountSetting = JSON.parse(context.state.settings.find((x: any) => x.name === 'minWithdrawal').value)
174
+ let minAmount = minAmountSetting[config.currency] || (await minAmountSetting['RUB'].convert({ from: 'RUB', to: config.currency }))
175
+ validateArgs.minAmount = minAmount
206
176
 
207
177
  // prettier-ignore
208
178
  return (
@@ -222,20 +192,20 @@ export class WithdrawalCommand extends Command {
222
192
  },
223
193
  numberValidator({ allowFloat: true, min: 0 }),
224
194
  async ({ value, context, validateArgs }) => {
225
- const config = Client.config(context);
226
- const amountInRUB = await value.convert({ from: config.currency, to: 'RUB' });
195
+ const config = Client.config(context)
196
+ const amountInRUB = await value.convert({ from: config.currency, to: 'RUB' })
227
197
 
228
198
  // prettier-ignore
229
199
  if (value < validateArgs.minAmount) throw new Error(`Минимальная сумма для вывода: ${Number(validateArgs.minAmount).toLocaleString('ru')} ${config.currency.toUpperCase()}`);
230
- if (amountInRUB > context.user.db.balance) throw new Error('Вы пытаетесь вывести больше, чем у вас есть');
200
+ if (amountInRUB > context.user.db.balance) throw new Error('Вы пытаетесь вывести больше, чем у вас есть')
231
201
 
232
- return value;
202
+ return value
233
203
  }
234
204
  )
235
205
  amount: number,
236
206
  @CommandArgument('confirm', async ({ context, value, validateArgs, args }) => {
237
- if (value) return value;
238
- const config = Client.config(context);
207
+ if (value) return value
208
+ const config = Client.config(context)
239
209
 
240
210
  // prettier-ignore
241
211
  context.sendFormatted(
@@ -260,40 +230,12 @@ export class WithdrawalCommand extends Command {
260
230
  })
261
231
  confirm: boolean
262
232
  ) {
263
- const config = Client.config(context);
264
-
265
- const amountInRUB = await amount.convert({ from: config.currency, to: 'RUB' });
266
- if (context.user.db.balance < amountInRUB) throw new Error('Недостаточно средств');
267
-
268
- const id = await WithdrawalCommand.processWithdrawal(context, amount, requisites, method, coin, bank);
269
-
270
- // context.user.db.balance -= amountInRUB;
271
- // await context.user.db.save();
272
-
273
- // const withdrawal = await DatabaseManager.getInstance()
274
- // .dataSource.getRepository(Withdrawals)
275
- // .save({
276
- // amount: Number(amount),
277
- // method,
278
- // coin: method === 'crypto' ? coin : undefined,
279
- // requisites: method === 'crypto' ? requisites.wallet : requisites.phone || requisites.card || requisites.formatted,
280
- // user: context.user.db,
281
- // });
233
+ const config = Client.config(context)
282
234
 
283
- // const _method = method === 'crypto' ? `Крипто-кошелек ${coin.toUpperCase()}` : method === 'sbp' ? 'Номер телефона' : 'Банковская карта';
284
- // context.user.db.requisites = `${withdrawal.requisites} [${_method}${method === 'sbp' ? ` [${bank}]` : ''}]`;
285
-
286
- console.log(
287
- {
288
- text: '🚀 Выплатить',
289
- callback_data: `${AdminWithdrawalCommand.name}?id=${id}&decision=1`,
290
- },
291
- {
292
- text: '❌ Отказать',
293
- callback_data: `${AdminWithdrawalCommand.name}?id=${id}&decision=0`,
294
- }
295
- );
235
+ const amountInRUB = await amount.convert({ from: config.currency, to: 'RUB' })
236
+ if (context.user.db.balance < amountInRUB) throw new Error('Недостаточно средств')
296
237
 
238
+ const id = await WithdrawalCommand.processWithdrawal(context, amount, requisites, method, coin, bank)
297
239
  context.user.log(0, `Заявка на вывод средств ${amountInRUB}`, {
298
240
  // prettier-ignore
299
241
  message:
@@ -312,7 +254,7 @@ export class WithdrawalCommand extends Command {
312
254
  },
313
255
  ],
314
256
  ],
315
- });
257
+ })
316
258
 
317
259
  // prettier-ignore
318
260
  context.sendFormatted({
@@ -346,6 +288,6 @@ export class WithdrawalCommand extends Command {
346
288
  }))
347
289
  ),
348
290
  {}
349
- );
291
+ )
350
292
  }
351
293
  }
@@ -227,3 +227,8 @@ export class ParserSharedCommandsService {
227
227
  return results
228
228
  }
229
229
  }
230
+
231
+ // export const ParserSharedCommandsServiceInstance = new ParserSharedCommandsService()
232
+ // const code = ParserSharedCommandsService.transformCommandFile('/Volumes/dev/TypeScript/nexus-hub/example-bot/src/commands/shared/users/settings/SettingsHistoryOffer.srdcmd.ts')
233
+
234
+ // fs.writeFileSync('./code.js', code)