diff --git a/src/bot/features/metaBlacklist.ts b/src/bot/features/metaBanlist.ts similarity index 96% rename from src/bot/features/metaBlacklist.ts rename to src/bot/features/metaBanlist.ts index 7cb745b..92509da 100644 --- a/src/bot/features/metaBlacklist.ts +++ b/src/bot/features/metaBanlist.ts @@ -17,7 +17,7 @@ const feature = composer.chatType(["group", "supergroup"]); */ feature.hears( metaRegex, - logHandle("blacklist-detection-meta"), + logHandle("banlist-detection-meta"), async (ctx: Context) => { const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; @@ -64,4 +64,4 @@ feature.hears( } ); -export { composer as metaBlacklist }; +export { composer as metaBanlist }; diff --git a/src/bot/features/twitterBlacklist.ts b/src/bot/features/twitterBanlist.ts similarity index 96% rename from src/bot/features/twitterBlacklist.ts rename to src/bot/features/twitterBanlist.ts index 8acea31..e8c4fa5 100644 --- a/src/bot/features/twitterBlacklist.ts +++ b/src/bot/features/twitterBanlist.ts @@ -17,7 +17,7 @@ const feature = composer.chatType(["group", "supergroup"]); */ feature.hears( twitterRegex, - logHandle("blacklist-detection-twitter"), + logHandle("banlist-detection-twitter"), async (ctx: Context) => { const mutationKey = process.env.GRAPHQL_MUTATION_KEY || ""; @@ -64,4 +64,4 @@ feature.hears( } ); -export { composer as twitterBlacklist }; +export { composer as twitterBanlist }; diff --git a/src/lib/metaLinkCheck.ts b/src/lib/metaLinkCheck.ts index 7e14c3c..9e24bd0 100644 --- a/src/lib/metaLinkCheck.ts +++ b/src/lib/metaLinkCheck.ts @@ -5,7 +5,7 @@ const metaRegex = /** * This function will check if a url matches Meta services links using regex. * - * @param linkUrl representing a suspected blacklisted url + * @param linkUrl representing a suspected url on the banlist * @returns flag */ const metaLinkCheck = (linkUrl: string): boolean => { diff --git a/src/lib/tiktokLinkCheck.ts b/src/lib/tiktokLinkCheck.ts new file mode 100644 index 0000000..6e72f56 --- /dev/null +++ b/src/lib/tiktokLinkCheck.ts @@ -0,0 +1,21 @@ +// Global regex used to detect TikTok links. +const tiktokRegex = /(tiktok\.com)/gi; + +/** + * This function will check if a url matches TikTok services links using regex. + * + * @param linkUrl representing a suspected url on the banlist + * @return flag + */ +const tiktokLinkCheck = (linkUrl: string): boolean => { + let flag = false; + + if (linkUrl.match(tiktokRegex)) { + flag = true; + } + + return flag; +}; + +export { tiktokRegex }; +export default tiktokLinkCheck;