Skip to content

Commit 5ef543a

Browse files
committed
Update api
1 parent abdb645 commit 5ef543a

File tree

7 files changed

+21
-9
lines changed

7 files changed

+21
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea/
22
.env
3+
im/
34
node_modules/

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monster",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "",
55
"main": "src/index.js",
66
"scripts": {

src/classes/Command.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Command {
1717
}
1818
this.flags = params.flags || {};
1919
this.module = null;
20+
this.processClass = params.processClass || Process;
2021
}
2122

2223
async filtering(message) {
@@ -30,7 +31,7 @@ class Command {
3031

3132
async exec(message) {
3233
if (await this.filtering(message)) {
33-
const process = new Process(message, this);
34+
const process = new this.processClass(message, this);
3435
process.module = this.module;
3536
await process.run();
3637
}

src/classes/Form.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ class Form {
1010
async create(channel) {
1111
let msgData = await this.render(this.data);
1212
if (typeof msgData === 'object') {
13+
let file = null;
14+
if (msgData.file) {
15+
file = msgData.file;
16+
delete msgData.file;
17+
}
1318
msgData = {embed: msgData};
19+
if (file) {
20+
msgData.file = file;
21+
}
1422
}
1523
this.message = await channel.send(msgData);
1624
return this.message;

src/classes/Process.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ class Process {
2424
}
2525

2626
async run() {
27-
this.flags = this.getFlags();
27+
if (!this.flags) {
28+
this.flags = this.getFlags();
29+
}
2830
await this.command.handler.call(this, this.message);
2931
this.hookContainer.clear();
3032
}
@@ -41,7 +43,9 @@ class Process {
4143

4244
if (req.type === 'channel') {
4345
const val = (new RegExp(`${key}=\\<\\#(\\d+)\\>`)).exec(this.message.content);
44-
res[key] = this.message.guild.channels.get(val[1]);
46+
if (val) {
47+
res[key] = this.message.guild.channels.get(val[1]);
48+
}
4549
} else if (req.type === 'flag') {
4650
let val = ((new RegExp(`\\s${key}(\\s+|$)`)).exec(this.message.content));
4751
if (val)

src/classes/Processor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Processor {
66
constructor() {
77
this.hookProcessor = Hook.createHookProcessor();
88
this.client = new Discord.Client();
9-
this.modules = []
9+
this.modules = [];
1010
}
1111

1212
async activate() {

src/modules/system.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ systemModule.addCommand(new Command({
2525
},
2626
async handler() {
2727
const form = await this.answer({ping: this.module.processor.client.ping});
28-
setTimeout(()=> {
29-
form.update({ping: 5000});
30-
}, 3000)
3128
},
3229
}));
3330

@@ -282,7 +279,8 @@ systemModule.addCommand(new Command({
282279
value: client.users.size,
283280
inline: true,
284281
}
285-
]
282+
],
283+
description: `[github](https://github.com/Sdju/monster)`
286284
}
287285
},
288286
},

0 commit comments

Comments
 (0)