nexushub-commands 1.6.4 → 1.6.6

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.
@@ -21,6 +21,11 @@ let DepositByPromocodeCommand = class DepositByPromocodeCommand extends evogram_
21
21
  `<i>— Сумма: {{ ${yield promocode.amount.convert({ from: 'RUB', to: config.currency })} }}</i>\n\n` +
22
22
  `<i>— Ваш баланс: {{ ${yield context.user.db.balance.convert({ from: 'RUB', to: config.currency })} }}</i>`,
23
23
  });
24
+ yield context.user.log(0, `Пополнение через промокод`, {
25
+ message: `<i>— Код промокода: <code>${promocode.code}</code></i>\n` +
26
+ `<i>— Сумма: ${yield promocode.amount.convert()}</i>\n\n` +
27
+ `<i>— Баланс: ${yield context.user.db.balance.convert()}</i>`,
28
+ });
24
29
  });
25
30
  }
26
31
  };
@@ -36,7 +41,9 @@ tslib_1.__decorate([
36
41
  .then((x) => x.text),
37
42
  }, (0, evogram_1.stringValidator)({ minLength: 16, maxLength: 16 }), (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ value, context }) {
38
43
  const config = Client_1.Client.config(context);
39
- const promocode = yield config.API.get(`/promocodes/${value}`).then((x) => x.data);
44
+ const promocode = yield config.API.get(`/promocodes/codes/${value}`)
45
+ .then((x) => x.data)
46
+ .catch(() => null);
40
47
  if (!promocode)
41
48
  throw new Error('Промокод не найден');
42
49
  return promocode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexushub-commands",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "main": "./lib/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -22,7 +22,9 @@ export class DepositByPromocodeCommand extends Command {
22
22
  async ({ value, context }) => {
23
23
  const config = Client.config(context);
24
24
 
25
- const promocode = await config.API.get(`/promocodes/${value}`).then((x) => x.data);
25
+ const promocode = await config.API.get(`/promocodes/codes/${value}`)
26
+ .then((x) => x.data)
27
+ .catch(() => null);
26
28
  if (!promocode) throw new Error('Промокод не найден');
27
29
 
28
30
  return promocode;
@@ -48,5 +50,12 @@ export class DepositByPromocodeCommand extends Command {
48
50
 
49
51
  `<i>— Ваш баланс: {{ ${await context.user.db.balance.convert({ from: 'RUB', to: config.currency })} }}</i>`,
50
52
  });
53
+
54
+ await context.user.log(0, `Пополнение через промокод`, {
55
+ message:
56
+ `<i>— Код промокода: <code>${promocode.code}</code></i>\n` +
57
+ `<i>— Сумма: ${await promocode.amount.convert()}</i>\n\n` +
58
+ `<i>— Баланс: ${await context.user.db.balance.convert()}</i>`,
59
+ });
51
60
  }
52
61
  }