forked from Supositware/Haha-Yes
Can now set for how long slowmode will remain active
This commit is contained in:
parent
ecb27a72e3
commit
7214614e01
1 changed files with 26 additions and 4 deletions
|
@ -15,15 +15,37 @@ module.exports = class CustomResponseCommand extends Command {
|
||||||
key: 'slowmodeNumber',
|
key: 'slowmodeNumber',
|
||||||
prompt: 'How many seconds should the slowmode be? ( 0 to remove it )',
|
prompt: 'How many seconds should the slowmode be? ( 0 to remove it )',
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'realtime',
|
||||||
|
prompt: 'How long shoud it remain',
|
||||||
|
default: '',
|
||||||
|
type: 'integer',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(message, { slowmodeNumber }) {
|
async run(message, { slowmodeNumber, realtime }) {
|
||||||
if (slowmodeNumber < 120)
|
if (slowmodeNumber > 120)
|
||||||
message.say("Slowmode can only be set to 120 seconds or lower!");
|
return message.say("Slowmode can only be set to 120 seconds or lower!");
|
||||||
|
|
||||||
message.channel.setRateLimitPerUser(slowmodeNumber);
|
message.channel.setRateLimitPerUser(slowmodeNumber);
|
||||||
message.say(`Slowmode have been set to ${slowmodeNumber} seconds`);
|
|
||||||
|
if (realtime) {
|
||||||
|
let time = 60000 * realtime;
|
||||||
|
message.say(`Slowmode have been set to ${slowmodeNumber} seconds and will end in ${realtime} minutes!`);
|
||||||
|
var interval = setInterval (function (){
|
||||||
|
message.channel.setRateLimitPerUser(0);
|
||||||
|
message.say("Slowmode is now disabled!")
|
||||||
|
}, time);
|
||||||
|
} else {
|
||||||
|
if (slowmodeNumber == 0)
|
||||||
|
return message.say("Slowmode have been disabled!")
|
||||||
|
return message.say(`Slowmode have been set to ${slowmodeNumber} seconds!`);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Reference in a new issue