catto.js 0.7.4 → 0.7.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.
Files changed (2) hide show
  1. package/Bot.js +15 -2
  2. package/package.json +1 -1
package/Bot.js CHANGED
@@ -109,6 +109,9 @@ module.exports = class extends EventEmitter {
109
109
  option.setName(opt.name);
110
110
  option.setDescription(opt.description);
111
111
  option.setRequired(opt.required);
112
+ if (opt.types) {
113
+ option.addChannelTypes(...opt.types);
114
+ }
112
115
  cmdo.addChannelOption(option);
113
116
  break;
114
117
  case "role":
@@ -148,9 +151,19 @@ module.exports = class extends EventEmitter {
148
151
  break;
149
152
  }
150
153
  }
154
+ var integration_types = [0];
155
+ if (cmd.user) {
156
+ integration_types.push(1);
157
+ }
158
+ var contexts = [0];
159
+ if (cmd.dm) {
160
+ contexts.push(1);
161
+ }
162
+ if (cmd.user) {
163
+ contexts.push(2);
164
+ }
151
165
  cmds.push(Object.assign(cmdo.toJSON(), {
152
- "integration_types": [0, 1].slice(0, (cmd.user ? 2 : 1)),
153
- "contexts": [0, 1, 2].slice(0, (cmd.user ? 3 : 2)),
166
+ integration_types, contexts
154
167
  }));
155
168
  }
156
169
  for (var cmd of this.userContexts.values()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catto.js",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "Universal module for everything.",
5
5
  "main": "index.js",
6
6
  "scripts": {