From 6064cad87fbf7b1c459e155f4f960945bb56bdc7 Mon Sep 17 00:00:00 2001 From: freearhey Date: Wed, 27 Jan 2021 18:54:22 +0300 Subject: [PATCH] Update helper.js --- scripts/helper.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/scripts/helper.js b/scripts/helper.js index d22332fdf..fedc1eed9 100644 --- a/scripts/helper.js +++ b/scripts/helper.js @@ -241,6 +241,41 @@ helper.filterGroup = function (groupTitle) { return this.supportedCategories[groupTitle.toLowerCase()] || '' } +helper.filterNSFW = function (arr) { + const sfwCategories = [ + 'Auto', + 'Business', + 'Classic', + 'Comedy', + 'Documentary', + 'Education', + 'Entertainment', + 'Family', + 'Fashion', + 'Food', + 'General', + 'Health', + 'History', + 'Hobby', + 'Kids', + 'Legislative', + 'Lifestyle', + 'Local', + 'Movies', + 'Music', + 'News', + 'Quiz', + 'Religious', + 'Sci-Fi', + 'Shop', + 'Sport', + 'Travel', + 'Weather' + ] + + return arr.filter(i => sfwCategories.includes(i.category)) +} + helper.sleep = function (ms) { return function (x) { return new Promise(resolve => setTimeout(() => resolve(x), ms))