From 81c179c39c0526a422121feec41c9c9bdc95ca39 Mon Sep 17 00:00:00 2001
From: loicbersier <loic.bersier1@gmail.com>
Date: Sun, 24 May 2020 19:17:40 +0200
Subject: [PATCH] Let people choose max and min clip duration

Signed-off-by: loicbersier <loic.bersier1@gmail.com>
---
 commands/fun/ytp.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/commands/fun/ytp.js b/commands/fun/ytp.js
index 54297a88..dfb3cf0d 100644
--- a/commands/fun/ytp.js
+++ b/commands/fun/ytp.js
@@ -100,12 +100,16 @@ class ytpCommand extends Command {
 				{
 					id: 'link',
 					type: 'string'
+				},
+				{
+					id: 'max',
+					type: 'string'
 				}
 			],
 			description: {
 				content: 'Generate random ytp | --add with a link or attachment to add a video to the pool, only .mp4 work | --pool to see how many vid there is currently in the pool | --force to make the command work outside of nsfw channel BE AWARE THAT IT WON\'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN',
-				usage: '',
-				examples: ['']
+				usage: '(OPTIONAL) | [Minimum length of clip] [Max length of clip]',
+				examples: ['5 10']
 			}
 		});
 	}
@@ -209,7 +213,8 @@ class ytpCommand extends Command {
 
 		let options = {
 			debug: args.debug,
-			MAX_STREAM_DURATION: args.link ? args.link : Math.floor((Math.random() * 3) + 1), // Random duration of video clip
+			MIN_STREAM_DURATION: args.link ? Math.floor(args.link) : null,
+			MAX_STREAM_DURATION: args.max ? args.max : Math.floor(args.link * 1.5),
 			sources: './asset/ytp/sources/',
 			sounds: './asset/ytp/sounds/',
 			music: './asset/ytp/music/',