mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Use NSFW Site List in Phone and Portal
This commit is contained in:
@@ -41,6 +41,7 @@ module.exports = class XiaoClient extends CommandoClient {
|
||||
this.phone = new PhoneManager(this);
|
||||
this.activities = activities;
|
||||
this.leaveMessages = leaveMsgs;
|
||||
this.adultSiteList = null;
|
||||
}
|
||||
|
||||
async registerFontsIn(filepath) {
|
||||
@@ -156,6 +157,15 @@ module.exports = class XiaoClient extends CommandoClient {
|
||||
return buf;
|
||||
}
|
||||
|
||||
async fetchAdultSiteList(force = false) {
|
||||
if (!force && this.adultSiteList) return this.adultSiteList;
|
||||
const { text } = await request.get('https://raw.githubusercontent.com/blocklistproject/Lists/master/porn.txt');
|
||||
this.adultSiteList = text.split('\n')
|
||||
.filter(site => site && !site.startsWith('#'))
|
||||
.map(site => site.replace(/^(0.0.0.0 )/, '')); // eslint-disable-line no-control-regex
|
||||
return this.adultSiteList;
|
||||
}
|
||||
|
||||
fetchReportChannel() {
|
||||
if (!REPORT_CHANNEL_ID) return null;
|
||||
return this.channels.fetch(REPORT_CHANNEL_ID);
|
||||
|
||||
Reference in New Issue
Block a user