Skip to content

Commit abcb7d9

Browse files
authored
Merge pull request #22 from ItsJustMeChris/master
Fix warnings
2 parents 488eabd + 98b1623 commit abcb7d9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

plugins/moderation/warn.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ commands.register(this.command, '([^s]+) (.*)', 'warn <@user> <reason>', 'Warn a
3636
msg.channel.send(`Warned {${extra[1]}} for {${extra[2]}}`);
3737
return warnedUser.send(`You have been warned for {${extra[2]}}`);
3838
});
39+
} else {
40+
UserWarning.create({ user, warning, warner }, (warningError) => {
41+
if (warningError) throw warningError;
42+
msg.channel.send(`Warned {${extra[1]}} for {${extra[2]}}`);
43+
return warnedUser.send(`You have been warned for {${extra[2]}}`);
44+
});
3945
}
40-
UserWarning.create({ user, warning, warner }, (warningError) => {
41-
if (warningError) throw warningError;
42-
msg.channel.send(`Warned {${extra[1]}} for {${extra[2]}}`);
43-
return warnedUser.send(`You have been warned for {${extra[2]}}`);
44-
});
46+
} else {
47+
return msg.reply('Cannot warn, error?');
4548
}
46-
return msg.channel.send('Cannot warn, error?');
49+
return false;
4750
});
4851

4952
commands.register(this.command, 'list (.*)', 'warn list <@user>', 'List a users warnings', async (msg) => {

0 commit comments

Comments
 (0)