Toxicity and Severe support for messages

This commit is contained in:
Dragon Fire
2021-02-09 17:29:25 -05:00
parent 0e1754ae89
commit 0437a66e29
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const request = require('node-superfetch'); const request = require('node-superfetch');
const { Message } = require('discord.js');
const { GOOGLE_KEY } = process.env; const { GOOGLE_KEY } = process.env;
module.exports = class SevereToxicityCommand extends Command { module.exports = class SevereToxicityCommand extends Command {
@@ -21,13 +22,14 @@ module.exports = class SevereToxicityCommand extends Command {
{ {
key: 'text', key: 'text',
prompt: 'What text do you want to test the toxicity of?', prompt: 'What text do you want to test the toxicity of?',
type: 'string' type: 'message|string'
} }
] ]
}); });
} }
async run(msg, { text }) { async run(msg, { text }) {
if (text instanceof Message) text = text.content;
try { try {
const { body } = await request const { body } = await request
.post('https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze') .post('https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze')
+3 -1
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const request = require('node-superfetch'); const request = require('node-superfetch');
const { Message } = require('discord.js');
const { GOOGLE_KEY } = process.env; const { GOOGLE_KEY } = process.env;
module.exports = class ToxicityCommand extends Command { module.exports = class ToxicityCommand extends Command {
@@ -21,13 +22,14 @@ module.exports = class ToxicityCommand extends Command {
{ {
key: 'text', key: 'text',
prompt: 'What text do you want to test the toxicity of?', prompt: 'What text do you want to test the toxicity of?',
type: 'string' type: 'message|string'
} }
] ]
}); });
} }
async run(msg, { text }) { async run(msg, { text }) {
if (text instanceof Message) text = text.content;
try { try {
const { body } = await request const { body } = await request
.post('https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze') .post('https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze')