nexushub-commands 2.5.2 → 2.5.4
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 +2 -1
- package/lib/commands/registration/Registration.command.js +2 -3
- package/lib/commands/withdrawal/Withdrawal.command.js +11 -0
- package/package.json +1 -1
- package/src/commands/deposit/Deposit.command.ts +1 -1
- package/src/commands/registration/Registration.command.ts +1 -2
- package/src/commands/withdrawal/Withdrawal.command.ts +11 -0
|
@@ -27,6 +27,7 @@ function maskExceptLast4(str) {
|
|
|
27
27
|
let DepositCommand = DepositCommand_1 = class DepositCommand extends evogram_1.Command {
|
|
28
28
|
execute(context, method, coin, deposit) {
|
|
29
29
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
var _a;
|
|
30
31
|
const config = Client_1.Client.config(context);
|
|
31
32
|
let interval;
|
|
32
33
|
if (['card'].includes(method)) {
|
|
@@ -86,7 +87,7 @@ let DepositCommand = DepositCommand_1 = class DepositCommand extends evogram_1.C
|
|
|
86
87
|
if (method === 'card' && config.currency.toUpperCase() === 'RUB') {
|
|
87
88
|
const availableMyRequisites = (yield config.API.get('/myrequisites')).data;
|
|
88
89
|
const myRequisites = (yield config.API.get(`/aggregators/myrequisites`)).data;
|
|
89
|
-
const _minAmount = availableMyRequisites.sort((a, b) => a.minAmount - b.minAmount)[0].minAmount;
|
|
90
|
+
const _minAmount = (_a = availableMyRequisites.sort((a, b) => a.minAmount - b.minAmount)[0]) === null || _a === void 0 ? void 0 : _a.minAmount;
|
|
90
91
|
const minAmount = myRequisites.minAmount > _minAmount ? myRequisites.minAmount : _minAmount;
|
|
91
92
|
if (availableMyRequisites.length > 0 && myRequisites.enabled) {
|
|
92
93
|
return context.sendFormatted({
|
|
@@ -20,18 +20,17 @@ let RegistrationCommand = RegistrationCommand_1 = class RegistrationCommand exte
|
|
|
20
20
|
}
|
|
21
21
|
execute(context) {
|
|
22
22
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var _a, _b, _c, _d, _e;
|
|
23
|
+
var _a, _b, _c, _d, _e, _f;
|
|
24
24
|
const config = Client_1.Client.config(context);
|
|
25
25
|
if (/\/(start|registration) \d+/.test(context.text) || Number(context.text))
|
|
26
26
|
context.user.userDB.payload.refCode = Number((_a = /(\/(start|registration) )?(\d+)/.exec(context.text)) === null || _a === void 0 ? void 0 : _a[3]);
|
|
27
|
-
console.log({ refCode: context.user.userDB.payload.refCode, text: context.text });
|
|
28
27
|
if (!context.user.userDB.payload.agreement)
|
|
29
28
|
return context.sendFormatted({
|
|
30
29
|
designImages: ['registration', 'banner'],
|
|
31
30
|
body: [
|
|
32
31
|
{
|
|
33
32
|
title: `🎉 Привет, {{ ${context.user.fullname} }}!`,
|
|
34
|
-
data: [[`<a href="${((_b = context.state.mirror) === null || _b === void 0 ? void 0 : _b.projectMirror.userAgreement) || ((
|
|
33
|
+
data: [[`<a href="${((_c = (_b = context.state.mirror) === null || _b === void 0 ? void 0 : _b.projectMirror) === null || _c === void 0 ? void 0 : _c.userAgreement) || ((_f = (_e = (_d = context === null || context === void 0 ? void 0 : context.state) === null || _d === void 0 ? void 0 : _d.settings) === null || _e === void 0 ? void 0 : _e.find((x) => x.name === 'userAgreement')) === null || _f === void 0 ? void 0 : _f.value) || config.agreement}">Политика и условия пользования</a>`]],
|
|
35
34
|
},
|
|
36
35
|
],
|
|
37
36
|
}, {
|
|
@@ -43,6 +43,8 @@ let WithdrawalCommand = WithdrawalCommand_1 = class WithdrawalCommand extends ev
|
|
|
43
43
|
// prettier-ignore
|
|
44
44
|
context.sendFormatted({
|
|
45
45
|
photo: method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
|
|
46
|
+
//@ts-ignore
|
|
47
|
+
designImages: [...({ card: ['withdrawal-success-card'], sbp: ['withdrawal-success-sbp'] }[args.method] || ['withdrawal-success-crypto']), 'withdrawal-success', ...({ card: ['withdrawal-card'], sbp: ['withdrawal-sbp'] }[args.method] || ['withdrawal-crypto']), 'withdrawal', 'profile', 'banner'],
|
|
46
48
|
header: '<blockquote><b>💸 Создана заявка на вывод средств</b></blockquote>\n\n' +
|
|
47
49
|
`<i>— Сумма: {{ ${amount.toLocaleString('ru')} ${config.currency.toUpperCase()} }}</i>\n` +
|
|
48
50
|
`<i>— Реквизиты: {{ ${method === 'crypto' ? requisites.wallet : requisites.phone || requisites.card || requisites.formatted} }}</i>\n` +
|
|
@@ -105,6 +107,7 @@ tslib_1.__decorate([
|
|
|
105
107
|
const config = Client_1.Client.config(context);
|
|
106
108
|
yield context.sendFormatted({
|
|
107
109
|
photo: config.images.withdrawal,
|
|
110
|
+
designImages: ['withdrawal', 'profile', 'banner'],
|
|
108
111
|
header: '<b>📤 Выберите удобный для вас метод вывода.</b>',
|
|
109
112
|
}, {
|
|
110
113
|
reply_markup: {
|
|
@@ -120,6 +123,7 @@ tslib_1.__decorate([
|
|
|
120
123
|
const config = Client_1.Client.config(context);
|
|
121
124
|
return (yield context.sendFormattedQuestion({
|
|
122
125
|
photo: config.images.withdrawal,
|
|
126
|
+
designImages: ['withdrawal-sbp-bank', 'withdrawal-sbp', 'withdrawal', 'profile', 'banner'],
|
|
123
127
|
body: [
|
|
124
128
|
{
|
|
125
129
|
title: '💳 Банк для вывода',
|
|
@@ -152,6 +156,7 @@ tslib_1.__decorate([
|
|
|
152
156
|
const config = Client_1.Client.config(context);
|
|
153
157
|
yield context.sendFormatted({
|
|
154
158
|
photo: config.images.withdrawalCrypto,
|
|
159
|
+
designImages: ['withdrawal-crypto-coin', 'withdrawal-crypto', 'withdrawal', 'profile', 'banner'],
|
|
155
160
|
header: '<b>🪙 Доступные сети для вывода:</b>',
|
|
156
161
|
}, {
|
|
157
162
|
reply_markup: {
|
|
@@ -167,6 +172,8 @@ tslib_1.__decorate([
|
|
|
167
172
|
const config = Client_1.Client.config(context);
|
|
168
173
|
return (yield context.sendFormattedQuestion({
|
|
169
174
|
photo: args.method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
|
|
175
|
+
//@ts-ignore
|
|
176
|
+
designImages: [...({ card: ['withdrawal-requisites-card'], sbp: ['withdrawal-requisites-sbp'] }[args.method] || ['withdrawal-requisites-crypto']), 'withdrawal-requisites', ...({ card: ['withdrawal-card'], sbp: ['withdrawal-sbp'] }[args.method] || ['withdrawal-crypto']), 'withdrawal', 'profile', 'banner'],
|
|
170
177
|
header: '<blockquote><b>✍️ Запрос на вывод средств</b></blockquote>',
|
|
171
178
|
footer: args.method === 'card' ? '<i>ℹ️ Отправьте Ваш номер банковской карты</i>' : args.method === 'sbp' ? '<i>ℹ️ Отправьте Ваш номер телефона</i>' : `<i>ℹ️ Отправьте Ваш адрес крипто-кошелька {{ ${(_b = args.coin) === null || _b === void 0 ? void 0 : _b.toUpperCase()} }}</i>`,
|
|
172
179
|
error: error === null || error === void 0 ? void 0 : error.message,
|
|
@@ -219,6 +226,8 @@ tslib_1.__decorate([
|
|
|
219
226
|
// prettier-ignore
|
|
220
227
|
return (yield context.sendFormattedQuestion({
|
|
221
228
|
photo: args.method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
|
|
229
|
+
//@ts-ignore
|
|
230
|
+
designImages: [...({ card: ['withdrawal-amount-card'], sbp: ['withdrawal-amount-sbp'] }[args.method] || ['withdrawal-amount-crypto']), 'withdrawal-amount', ...({ card: ['withdrawal-card'], sbp: ['withdrawal-sbp'] }[args.method] || ['withdrawal-crypto']), 'withdrawal', 'profile', 'banner'],
|
|
222
231
|
header: '<blockquote><b>✍️ Запрос на вывод средств</b></blockquote>\n\n' +
|
|
223
232
|
'Введите сумму, которую хотите вывести.\n' +
|
|
224
233
|
`<b>Ваш текущий баланс:</b> {{ ${yield context.user.db.balance.convert({ from: 'RUB', to: config.currency })} }}\n\n` +
|
|
@@ -244,6 +253,8 @@ tslib_1.__decorate([
|
|
|
244
253
|
// prettier-ignore
|
|
245
254
|
context.sendFormatted({
|
|
246
255
|
photo: args.method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
|
|
256
|
+
//@ts-ignore
|
|
257
|
+
designImages: [...({ card: ['withdrawal-confirm-card'], sbp: ['withdrawal-confirm-sbp'] }[args.method] || ['withdrawal-confirm-crypto']), 'withdrawal-confirm', ...({ card: ['withdrawal-card'], sbp: ['withdrawal-sbp'] }[args.method] || ['withdrawal-crypto']), 'withdrawal', 'profile', 'banner'],
|
|
247
258
|
header: '<blockquote><b>✍️ Запрос на вывод средств</b></blockquote>\n\n' +
|
|
248
259
|
`<i>— Сумма вывода: {{ ${Number(validateArgs.amount).toLocaleString('ru')} ${config.currency.toUpperCase()} }}</i>\n` +
|
|
249
260
|
`<i>— Реквизиты: {{ ${((_b = validateArgs.requisites) === null || _b === void 0 ? void 0 : _b.formatted) || ((_c = validateArgs.requisites) === null || _c === void 0 ? void 0 : _c.wallet)} }}</i>\n` +
|
package/package.json
CHANGED
|
@@ -245,7 +245,7 @@ export class DepositCommand extends Command {
|
|
|
245
245
|
if (method === 'card' && config.currency.toUpperCase() === 'RUB') {
|
|
246
246
|
const availableMyRequisites = (await config.API.get('/myrequisites')).data
|
|
247
247
|
const myRequisites = (await config.API.get(`/aggregators/myrequisites`)).data
|
|
248
|
-
const _minAmount = availableMyRequisites.sort((a: any, b: any) => a.minAmount - b.minAmount)[0]
|
|
248
|
+
const _minAmount = availableMyRequisites.sort((a: any, b: any) => a.minAmount - b.minAmount)[0]?.minAmount
|
|
249
249
|
const minAmount = myRequisites.minAmount > _minAmount ? myRequisites.minAmount : _minAmount
|
|
250
250
|
|
|
251
251
|
if (availableMyRequisites.length > 0 && myRequisites.enabled) {
|
|
@@ -18,7 +18,6 @@ export class RegistrationCommand extends Command {
|
|
|
18
18
|
const config = Client.config(context)
|
|
19
19
|
|
|
20
20
|
if (/\/(start|registration) \d+/.test(context.text!) || Number(context.text)) context.user.userDB.payload.refCode = Number(/(\/(start|registration) )?(\d+)/.exec(context.text!)?.[3])
|
|
21
|
-
console.log({ refCode: context.user.userDB.payload.refCode, text: context.text })
|
|
22
21
|
|
|
23
22
|
if (!context.user.userDB.payload.agreement)
|
|
24
23
|
return context.sendFormatted(
|
|
@@ -27,7 +26,7 @@ export class RegistrationCommand extends Command {
|
|
|
27
26
|
body: [
|
|
28
27
|
{
|
|
29
28
|
title: `🎉 Привет, {{ ${context.user.fullname} }}!`,
|
|
30
|
-
data: [[`<a href="${context.state.mirror?.projectMirror
|
|
29
|
+
data: [[`<a href="${context.state.mirror?.projectMirror?.userAgreement || context?.state?.settings?.find((x: any) => x.name === 'userAgreement')?.value || config.agreement}">Политика и условия пользования</a>`]],
|
|
31
30
|
},
|
|
32
31
|
],
|
|
33
32
|
},
|
|
@@ -39,6 +39,7 @@ export class WithdrawalCommand extends Command {
|
|
|
39
39
|
await context.sendFormatted(
|
|
40
40
|
{
|
|
41
41
|
photo: config.images.withdrawal,
|
|
42
|
+
designImages: ['withdrawal', 'profile', 'banner'],
|
|
42
43
|
header: '<b>📤 Выберите удобный для вас метод вывода.</b>',
|
|
43
44
|
},
|
|
44
45
|
{
|
|
@@ -60,6 +61,7 @@ export class WithdrawalCommand extends Command {
|
|
|
60
61
|
await context.sendFormattedQuestion(
|
|
61
62
|
{
|
|
62
63
|
photo: config.images.withdrawal,
|
|
64
|
+
designImages: ['withdrawal-sbp-bank', 'withdrawal-sbp', 'withdrawal', 'profile', 'banner'],
|
|
63
65
|
body: [
|
|
64
66
|
{
|
|
65
67
|
title: '💳 Банк для вывода',
|
|
@@ -100,6 +102,7 @@ export class WithdrawalCommand extends Command {
|
|
|
100
102
|
await context.sendFormatted(
|
|
101
103
|
{
|
|
102
104
|
photo: config.images.withdrawalCrypto,
|
|
105
|
+
designImages: ['withdrawal-crypto-coin', 'withdrawal-crypto', 'withdrawal', 'profile', 'banner'],
|
|
103
106
|
header: '<b>🪙 Доступные сети для вывода:</b>',
|
|
104
107
|
},
|
|
105
108
|
{
|
|
@@ -121,6 +124,8 @@ export class WithdrawalCommand extends Command {
|
|
|
121
124
|
return (
|
|
122
125
|
await context.sendFormattedQuestion({
|
|
123
126
|
photo: args.method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
|
|
127
|
+
//@ts-ignore
|
|
128
|
+
designImages: [...({ card: ['withdrawal-requisites-card'], sbp: ['withdrawal-requisites-sbp'] }[args.method] || ['withdrawal-requisites-crypto']), 'withdrawal-requisites', ...({ card: ['withdrawal-card'], sbp: ['withdrawal-sbp'] }[args.method] || ['withdrawal-crypto']), 'withdrawal', 'profile', 'banner'],
|
|
124
129
|
header: '<blockquote><b>✍️ Запрос на вывод средств</b></blockquote>',
|
|
125
130
|
footer: args.method === 'card' ? '<i>ℹ️ Отправьте Ваш номер банковской карты</i>' : args.method === 'sbp' ? '<i>ℹ️ Отправьте Ваш номер телефона</i>' : `<i>ℹ️ Отправьте Ваш адрес крипто-кошелька {{ ${args.coin?.toUpperCase()} }}</i>`,
|
|
126
131
|
error: error?.message,
|
|
@@ -178,6 +183,8 @@ export class WithdrawalCommand extends Command {
|
|
|
178
183
|
return (
|
|
179
184
|
await context.sendFormattedQuestion({
|
|
180
185
|
photo: args.method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
|
|
186
|
+
//@ts-ignore
|
|
187
|
+
designImages: [...({ card: ['withdrawal-amount-card'], sbp: ['withdrawal-amount-sbp'] }[args.method] || ['withdrawal-amount-crypto']), 'withdrawal-amount', ...({ card: ['withdrawal-card'], sbp: ['withdrawal-sbp'] }[args.method] || ['withdrawal-crypto']), 'withdrawal', 'profile', 'banner'],
|
|
181
188
|
header:
|
|
182
189
|
'<blockquote><b>✍️ Запрос на вывод средств</b></blockquote>\n\n' +
|
|
183
190
|
|
|
@@ -211,6 +218,8 @@ export class WithdrawalCommand extends Command {
|
|
|
211
218
|
context.sendFormatted(
|
|
212
219
|
{
|
|
213
220
|
photo: args.method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
|
|
221
|
+
//@ts-ignore
|
|
222
|
+
designImages: [...({ card: ['withdrawal-confirm-card'], sbp: ['withdrawal-confirm-sbp'] }[args.method] || ['withdrawal-confirm-crypto']), 'withdrawal-confirm', ...({ card: ['withdrawal-card'], sbp: ['withdrawal-sbp'] }[args.method] || ['withdrawal-crypto']), 'withdrawal', 'profile', 'banner'],
|
|
214
223
|
header:
|
|
215
224
|
'<blockquote><b>✍️ Запрос на вывод средств</b></blockquote>\n\n' +
|
|
216
225
|
|
|
@@ -272,6 +281,8 @@ export class WithdrawalCommand extends Command {
|
|
|
272
281
|
// prettier-ignore
|
|
273
282
|
context.sendFormatted({
|
|
274
283
|
photo: method === 'crypto' ? config.images.withdrawalCrypto : config.images.withdrawal,
|
|
284
|
+
//@ts-ignore
|
|
285
|
+
designImages: [...({ card: ['withdrawal-success-card'], sbp: ['withdrawal-success-sbp'] }[args.method] || ['withdrawal-success-crypto']), 'withdrawal-success', ...({ card: ['withdrawal-card'], sbp: ['withdrawal-sbp'] }[args.method] || ['withdrawal-crypto']), 'withdrawal', 'profile', 'banner'],
|
|
275
286
|
header:
|
|
276
287
|
'<blockquote><b>💸 Создана заявка на вывод средств</b></blockquote>\n\n' +
|
|
277
288
|
|