spacecommands 3.2.8 → 3.3.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.
@@ -2,8 +2,6 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- // @ts-nocheck
6
- const user_languages_1 = __importDefault(require("../models/user-languages"));
7
5
  const Events_1 = __importDefault(require("../enums/Events"));
8
6
  module.exports = {
9
7
  description: 'Displays or sets your personal language preference',
@@ -45,15 +43,7 @@ module.exports = {
45
43
  LANGUAGE: lang,
46
44
  }, user);
47
45
  }
48
- instance.messageHandler.setUserLanguage(user, lang);
49
- await user_languages_1.default.findOneAndUpdate({
50
- _id: user.id,
51
- }, {
52
- _id: user.id,
53
- language: lang,
54
- }, {
55
- upsert: true,
56
- });
46
+ await instance.messageHandler.setUserLanguage(user, lang);
57
47
  return instance.messageHandler.get(guild, 'NEW_LANGUAGE', {
58
48
  LANGUAGE: lang,
59
49
  }, user);
@@ -32,7 +32,7 @@ class ModalHandler {
32
32
  for (const [file, fileName] of files) {
33
33
  const handler = require(file);
34
34
  const config = handler.default || handler;
35
- if (config.type === 'modal') {
35
+ if (config.type === 'modal' || (config.customId && config.callback)) {
36
36
  this.registerModalHandler(config);
37
37
  }
38
38
  }
@@ -81,6 +81,16 @@ class MessageHandler {
81
81
  }
82
82
  async setUserLanguage(user, language) {
83
83
  this._userLanguages.set(user.id, language);
84
+ if (this._instance.isDBConnected()) {
85
+ await user_languages_1.default.findOneAndUpdate({
86
+ _id: user.id,
87
+ }, {
88
+ _id: user.id,
89
+ language,
90
+ }, {
91
+ upsert: true,
92
+ });
93
+ }
84
94
  }
85
95
  getLanguage(guild, user) {
86
96
  if (user) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spacecommands",
3
- "version": "3.2.8",
3
+ "version": "3.3.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "./typings.d.ts",
6
6
  "typings": "./typings.d.ts",