mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 14:55:40 +02:00
NSFW Command with Tensorflow
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user