mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 14:19:56 +02:00
Toxicity and Severe support for messages
This commit is contained in:
@@ -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')
|
||||||
|
|||||||
@@ -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')
|
||||||
|
|||||||
Reference in New Issue
Block a user