NSFW Command with Tensorflow

This commit is contained in:
Dragon Fire
2021-03-22 17:23:12 -04:00
parent 9f3cd4d2db
commit d837eec501
6 changed files with 66 additions and 1 deletions
+9
View File
@@ -4,7 +4,9 @@ const request = require('node-superfetch');
const Collection = require('@discordjs/collection');
const winston = require('winston');
const fontFinder = require('font-finder');
const nsfw = require('nsfwjs');
const fs = require('fs');
const url = require('url');
const path = require('path');
const Redis = require('./Redis');
const Font = require('./Font');
@@ -45,6 +47,7 @@ module.exports = class XiaoClient extends CommandoClient {
this.activities = activities;
this.leaveMessages = leaveMsgs;
this.adultSiteList = null;
this.nsfwModel = null;
}
async registerFontsIn(filepath) {
@@ -183,6 +186,12 @@ module.exports = class XiaoClient extends CommandoClient {
return this.adultSiteList;
}
async loadNSFWModel() {
const model = await nsfw.load(url.pathToFileURL(path.join(__dirname, '..', 'tf_models', 'nsfw')));
this.nsfwModel = model;
return this.nsfwModel;
}
fetchReportChannel() {
if (!REPORT_CHANNEL_ID) return null;
return this.channels.fetch(REPORT_CHANNEL_ID);