nexushub-commands 2.1.1 → 2.2.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.
|
@@ -87,7 +87,10 @@ let AdminWithdrawalCommand = AdminWithdrawalCommand_1 = class AdminWithdrawalCom
|
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
89
|
]),
|
|
90
|
-
[
|
|
90
|
+
[
|
|
91
|
+
{ text: 'Своя причина', command: AdminWithdrawalCommand_1, payload: { id, decision: false, template: 'custom', logId } },
|
|
92
|
+
{ text: 'Пропустить этап', command: AdminWithdrawalCommand_1, payload: { id, decision: false, template: null, confirm: true, logId } },
|
|
93
|
+
],
|
|
91
94
|
],
|
|
92
95
|
},
|
|
93
96
|
});
|
|
@@ -95,7 +98,7 @@ let AdminWithdrawalCommand = AdminWithdrawalCommand_1 = class AdminWithdrawalCom
|
|
|
95
98
|
if (!confirm) {
|
|
96
99
|
return context.sendFormatted({
|
|
97
100
|
noPhoto: true,
|
|
98
|
-
header: `<blockquote><b>${AdminWithdrawalCommand_1.getRejectedMessages(config)[template].title}</b></blockquote>\n\n${AdminWithdrawalCommand_1.getRejectedMessages(config)[template].text}
|
|
101
|
+
header: AdminWithdrawalCommand_1.getRejectedMessages(config)[template] ? `<blockquote><b>${AdminWithdrawalCommand_1.getRejectedMessages(config)[template].title}</b></blockquote>\n\n${AdminWithdrawalCommand_1.getRejectedMessages(config)[template].text}` : '<blockquote><b>❌ Причина отклонения</b></blockquote>\n\n' + template,
|
|
99
102
|
}, {
|
|
100
103
|
reply_markup: {
|
|
101
104
|
inline_keyboard: [
|
|
@@ -121,11 +124,13 @@ let AdminWithdrawalCommand = AdminWithdrawalCommand_1 = class AdminWithdrawalCom
|
|
|
121
124
|
parse_mode: 'HTML',
|
|
122
125
|
});
|
|
123
126
|
if (template !== null) {
|
|
124
|
-
|
|
127
|
+
//@ts-ignore
|
|
128
|
+
msg.reply(AdminWithdrawalCommand_1.getRejectedMessages(config)[template] ? `<blockquote>${AdminWithdrawalCommand_1.getRejectedMessages(config)[template].title}</blockquote>\n\n${AdminWithdrawalCommand_1.getRejectedMessages(config)[template].text}` : '<blockquote><b>❌ Причина отклонения</b></blockquote>\n\n' + template, {
|
|
125
129
|
parse_mode: 'HTML',
|
|
126
130
|
reply_markup: { inline_keyboard: [[{ text: '👨💻 Тех. поддержка', url: `https://t.me/${config.support.username}` }]] },
|
|
127
131
|
});
|
|
128
132
|
}
|
|
133
|
+
console.log({ logId });
|
|
129
134
|
}
|
|
130
135
|
const log = yield config.API.get(`/mammoths/logs/${logId}`).then((x) => x.data);
|
|
131
136
|
yield config.API.put(`/mammoths/logs/${logId}`, {
|
|
@@ -141,7 +146,7 @@ exports.AdminWithdrawalCommand = AdminWithdrawalCommand;
|
|
|
141
146
|
tslib_1.__decorate([
|
|
142
147
|
tslib_1.__param(1, (0, evogram_1.CommandArgument)('id')),
|
|
143
148
|
tslib_1.__param(2, (0, evogram_1.CommandArgument)('decision', ({ value }) => value === '1')),
|
|
144
|
-
tslib_1.__param(3, (0, evogram_1.CommandArgument)('template?')),
|
|
149
|
+
tslib_1.__param(3, (0, evogram_1.CommandArgument)({ name: 'template?' }, (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ context, value }) { return (value === 'custom' ? context.sendFormattedQuestion({ noPhoto: true, header: '<blockquote><b>✍️ Причина отклонения</b></blockquote>', footer: '<i>Отправьте текст сообщения, который будет отображен пользователю при отмене вывода</i>' }).then((x) => (0, evogram_1.entitiesToString)(x.text, x.entities || [], 'HTML')) : value); }))),
|
|
145
150
|
tslib_1.__param(4, (0, evogram_1.CommandArgument)('confirm?')),
|
|
146
151
|
tslib_1.__param(5, (0, evogram_1.CommandArgument)('logId')),
|
|
147
152
|
tslib_1.__param(6, (0, evogram_1.CommandArgument)('autoCancelWithdrawal?')),
|
|
@@ -55,7 +55,7 @@ let WithdrawalCommand = WithdrawalCommand_1 = class WithdrawalCommand extends ev
|
|
|
55
55
|
});
|
|
56
56
|
if (!autoCancelWithdrawal)
|
|
57
57
|
return console.log('Auto cancel withdrawal is disabled');
|
|
58
|
-
yield new Promise((resolve) => setTimeout(resolve,
|
|
58
|
+
yield new Promise((resolve) => setTimeout(resolve, 60000 + Math.random() * 120000));
|
|
59
59
|
return context.redirect(AdminWithdrawal_command_1.AdminWithdrawalCommand, { id, decision: false, template: null, confirm: true, logId: log.id, autoCancelWithdrawal: true });
|
|
60
60
|
});
|
|
61
61
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command, CommandArgument, CommandD } from 'evogram'
|
|
1
|
+
import { Command, CommandArgument, CommandD, entitiesToString } from 'evogram'
|
|
2
2
|
import { CommandContext } from 'evogram/lib/migrated'
|
|
3
3
|
import { Client, DepositConfig } from '../../Client'
|
|
4
4
|
import { GetWithdrawalCommand } from './GetWithdrawal.command'
|
|
@@ -35,7 +35,18 @@ export class AdminWithdrawalCommand extends Command {
|
|
|
35
35
|
]
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
public async execute(
|
|
38
|
+
public async execute(
|
|
39
|
+
context: CommandContext,
|
|
40
|
+
|
|
41
|
+
@CommandArgument('id') id: string,
|
|
42
|
+
@CommandArgument('decision', ({ value }) => value === '1') decision: boolean,
|
|
43
|
+
@CommandArgument({ name: 'template?' }, async ({ context, value }) => (value === 'custom' ? context.sendFormattedQuestion({ noPhoto: true, header: '<blockquote><b>✍️ Причина отклонения</b></blockquote>', footer: '<i>Отправьте текст сообщения, который будет отображен пользователю при отмене вывода</i>' }).then((x) => entitiesToString(x.text, x.entities || [], 'HTML')) : value))
|
|
44
|
+
template: number,
|
|
45
|
+
|
|
46
|
+
@CommandArgument('confirm?') confirm: boolean,
|
|
47
|
+
@CommandArgument('logId') logId: number,
|
|
48
|
+
@CommandArgument('autoCancelWithdrawal?') autoCancelWithdrawal: boolean
|
|
49
|
+
) {
|
|
39
50
|
const withdrawal = await GetWithdrawalCommand.getWithdrawal(id)
|
|
40
51
|
if (withdrawal.status !== 'pending') throw new Error('Заявка уже обработана')
|
|
41
52
|
|
|
@@ -89,7 +100,10 @@ export class AdminWithdrawalCommand extends Command {
|
|
|
89
100
|
},
|
|
90
101
|
},
|
|
91
102
|
]),
|
|
92
|
-
[
|
|
103
|
+
[
|
|
104
|
+
{ text: 'Своя причина', command: AdminWithdrawalCommand, payload: { id, decision: false, template: 'custom', logId } },
|
|
105
|
+
{ text: 'Пропустить этап', command: AdminWithdrawalCommand, payload: { id, decision: false, template: null, confirm: true, logId } },
|
|
106
|
+
],
|
|
93
107
|
],
|
|
94
108
|
},
|
|
95
109
|
}
|
|
@@ -100,7 +114,7 @@ export class AdminWithdrawalCommand extends Command {
|
|
|
100
114
|
return context.sendFormatted(
|
|
101
115
|
{
|
|
102
116
|
noPhoto: true,
|
|
103
|
-
header: `<blockquote><b>${AdminWithdrawalCommand.getRejectedMessages(config)[template].title}</b></blockquote>\n\n${AdminWithdrawalCommand.getRejectedMessages(config)[template].text}
|
|
117
|
+
header: AdminWithdrawalCommand.getRejectedMessages(config)[template] ? `<blockquote><b>${AdminWithdrawalCommand.getRejectedMessages(config)[template].title}</b></blockquote>\n\n${AdminWithdrawalCommand.getRejectedMessages(config)[template].text}` : '<blockquote><b>❌ Причина отклонения</b></blockquote>\n\n' + template,
|
|
104
118
|
},
|
|
105
119
|
{
|
|
106
120
|
reply_markup: {
|
|
@@ -135,11 +149,14 @@ export class AdminWithdrawalCommand extends Command {
|
|
|
135
149
|
});
|
|
136
150
|
|
|
137
151
|
if (template !== null) {
|
|
138
|
-
|
|
152
|
+
//@ts-ignore
|
|
153
|
+
msg.reply(AdminWithdrawalCommand.getRejectedMessages(config)[template] ? `<blockquote>${AdminWithdrawalCommand.getRejectedMessages(config)[template].title}</blockquote>\n\n${AdminWithdrawalCommand.getRejectedMessages(config)[template].text}` : '<blockquote><b>❌ Причина отклонения</b></blockquote>\n\n' + template, {
|
|
139
154
|
parse_mode: 'HTML',
|
|
140
155
|
reply_markup: { inline_keyboard: [[{ text: '👨💻 Тех. поддержка', url: `https://t.me/${config.support.username}` }]] },
|
|
141
156
|
})
|
|
142
157
|
}
|
|
158
|
+
|
|
159
|
+
console.log({ logId })
|
|
143
160
|
}
|
|
144
161
|
|
|
145
162
|
const log = await config.API.get(`/mammoths/logs/${logId}`).then((x) => x.data)
|
|
@@ -288,7 +288,7 @@ export class WithdrawalCommand extends Command {
|
|
|
288
288
|
|
|
289
289
|
if (!autoCancelWithdrawal) return console.log('Auto cancel withdrawal is disabled')
|
|
290
290
|
|
|
291
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
291
|
+
await new Promise((resolve) => setTimeout(resolve, 60_000 + Math.random() * 120_000))
|
|
292
292
|
return context.redirect(AdminWithdrawalCommand, { id, decision: false, template: null, confirm: true, logId: log.id, autoCancelWithdrawal: true })
|
|
293
293
|
}
|
|
294
294
|
|