mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-15 00:12:38 +02:00
Use NSFW Site List in Phone and Portal
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const crypto = require('crypto');
|
||||
const { decode: decodeHTML } = require('html-entities');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const url = require('url');
|
||||
const { SUCCESS_EMOJI_ID } = process.env;
|
||||
const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea', 'ya', 'hai', 'si', 'sí', 'oui', 'はい', 'correct'];
|
||||
const no = ['no', 'n', 'nah', 'nope', 'nop', 'iie', 'いいえ', 'non', 'fuck off'];
|
||||
@@ -204,6 +205,16 @@ module.exports = class Util {
|
||||
return str.replace(/(https?:\/\/\S+)/g, '<$1>');
|
||||
}
|
||||
|
||||
static stripNSFWURLs(str, siteList, text = '[redacted nsfw url]') {
|
||||
const uris = str.match(/(https?:\/\/\S+)/g);
|
||||
for (const uri of uris) {
|
||||
const parsed = url.parse(uri);
|
||||
if (!siteList.some(pornURL => parsed.host === pornURL)) continue;
|
||||
str = str.replace(uri, text);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static async reactIfAble(msg, user, emoji, fallbackEmoji) {
|
||||
const dm = !msg.guild;
|
||||
if (fallbackEmoji && (!dm && !msg.channel.permissionsFor(user).has('USE_EXTERNAL_EMOJIS'))) {
|
||||
|
||||
Reference in New Issue
Block a user