File tree Expand file tree Collapse file tree 4 files changed +392
-361
lines changed Expand file tree Collapse file tree 4 files changed +392
-361
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ /* eslint-disable sort-keys */
4+
35/*
46 * Create `config.js` by running `cp example.config.js config.js`
57 * in the project folder, then edit it.
@@ -30,7 +32,7 @@ module.exports = {
3032 * Which messages with commands should be deleted?
3133 * Defaults to 'own' -- don't delete commands meant for other bots.
3234 */
33- deleteCommands : 'own' , // eslint-disable-line sort-keys
35+ deleteCommands : 'own' ,
3436
3537 /**
3638 * @type {( number | string | false ) }
@@ -42,6 +44,15 @@ module.exports = {
4244 */
4345 deleteJoinsAfter : '2 minutes' ,
4446
47+ /**
48+ * @type {string[] }
49+ * List of blacklisted domains.
50+ * Messages containing blacklisted domains will automatically be warned.
51+ * If the link is shortened, an attempt will be made to resolve it.
52+ * If resolved link is blacklisted, it will be warned for.
53+ */
54+ blacklistedDomains : [ ] ,
55+
4556 /**
4657 * @type {( string[] | false ) }
4758 * List of whitelisted links and usernames,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const { telegram } = require('../../bot');
1414
1515const {
1616 excludeLinks = [ ] ,
17+ blacklistedDomains = [ ] ,
1718 notifyBrokenLink,
1819} = require ( '../../config' ) ;
1920
@@ -101,13 +102,10 @@ const dh = {
101102} ;
102103
103104const domainHandlers = new Map ( [
104- [ 'chat.whatsapp.com' , dh . blacklistedDomain ] ,
105- [ 'loverdesuootnosheniya.blogspot.com' , dh . blacklistedDomain ] ,
106105 [ 't.me' , dh . tme ] ,
107106 [ 'telegram.dog' , dh . tme ] ,
108107 [ 'telegram.me' , dh . tme ] ,
109- [ 'tinyurl.com' , dh . blacklistedDomain ] ,
110- [ 'your-sweet-dating.com' , dh . blacklistedDomain ] ,
108+ ...blacklistedDomains . map ( domain => [ domain , dh . blacklistedDomain ] )
111109] ) ;
112110
113111const isWhitelisted = ( url ) => customWhitelist . has ( stripQuery ( url . toString ( ) ) ) ;
You can’t perform that action at this time.
0 commit comments