mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
Add some stuff
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
const { Command } = require('discord.js-commando');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
|
const { CLEVERBOT_KEY } = process.env;
|
||||||
|
|
||||||
|
module.exports = class CleverbotCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'cleverbot',
|
||||||
|
aliases: ['clevs'],
|
||||||
|
group: 'other',
|
||||||
|
memberName: 'cleverbot',
|
||||||
|
description: 'Talk to Cleverbot!',
|
||||||
|
ownerOnly: true,
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'message',
|
||||||
|
prompt: 'What do you want to say to Cleverbot?',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
this.convos = new Map();
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { message }) {
|
||||||
|
try {
|
||||||
|
const { body } = await snekfetch
|
||||||
|
.get('https://www.cleverbot.com/getreply')
|
||||||
|
.query({
|
||||||
|
key: CLEVERBOT_KEY,
|
||||||
|
cs: this.convos.get(msg.channel.id),
|
||||||
|
input: message
|
||||||
|
});
|
||||||
|
this.convos.set(msg.channel.id, body.cs);
|
||||||
|
return msg.reply(body.output);
|
||||||
|
} catch (err) {
|
||||||
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
const { Command } = require('discord.js-commando');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
|
const { WEBHOOK_URL } = process.env;
|
||||||
|
|
||||||
|
module.exports = class WebhookCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'webhook',
|
||||||
|
aliases: ['rin', 'rin-say'],
|
||||||
|
group: 'text-edit',
|
||||||
|
memberName: 'webhook',
|
||||||
|
description: 'Posts a message to the webhook defined in your `process.env`.',
|
||||||
|
ownerOnly: true,
|
||||||
|
clientPermissions: ['MANAGE_MESSAGES'],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'content',
|
||||||
|
prompt: 'What text would you like the webhook to say?',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { content }) {
|
||||||
|
if (msg.channel.type === 'text') await msg.delete();
|
||||||
|
try {
|
||||||
|
await snekfetch.post(WEBHOOK_URL).send({ content });
|
||||||
|
return null;
|
||||||
|
} catch (err) {
|
||||||
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "51.3.3",
|
"version": "51.4.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "XiaoBot.js",
|
"main": "XiaoBot.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user