mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 22:23:03 -04:00
validate amount parameter (resolves #pb-2z2qi3i4q)
This commit is contained in:
parent
ce3d682aae
commit
ada3b7da4e
1 changed files with 3 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
const { Permissions } = require("detritus-client/lib/constants");
|
const { Permissions } = require("detritus-client/lib/constants");
|
||||||
|
|
||||||
|
const { createEmbed } = require("../../../labscore/utils/embed");
|
||||||
const { icon } = require("../../../labscore/utils/markdown");
|
const { icon } = require("../../../labscore/utils/markdown");
|
||||||
|
|
||||||
// TODO: copy pasted from v1, rework this eventually
|
// TODO: copy pasted from v1, rework this eventually
|
||||||
|
@ -29,6 +30,8 @@ module.exports = {
|
||||||
permissionsClient: [Permissions.MANAGE_MESSAGES],
|
permissionsClient: [Permissions.MANAGE_MESSAGES],
|
||||||
run: async (context, args) => {
|
run: async (context, args) => {
|
||||||
await context.triggerTyping();
|
await context.triggerTyping();
|
||||||
|
if(isNaN(parseInt(args.amount))) return editOrReply(createEmbed("warning", context, "Invalid Amount"))
|
||||||
|
|
||||||
if(args.amount >= 51 || args.amount <= 0){
|
if(args.amount >= 51 || args.amount <= 0){
|
||||||
return context.editOrReply(`${icon("failiure_simple")} ${context.message.author.mention}, Invalid amount (1-50).`);
|
return context.editOrReply(`${icon("failiure_simple")} ${context.message.author.mention}, Invalid amount (1-50).`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue