mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-11 03:14:35 +02:00
Remove Yoda Command (API is too Slow)
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class YodaCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'yoda',
|
||||
group: 'textedit',
|
||||
memberName: 'yoda',
|
||||
description: 'Converts text to Yoda Speak. (;yoda This is Yoda.)',
|
||||
examples: [';yoda This is Yoda.'],
|
||||
args: [{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to Yoda speak?',
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const text = encodeURIComponent(args.text);
|
||||
try {
|
||||
const response = await snekfetch
|
||||
.get(`https://yoda.p.mashape.com/yoda?sentence=${text}`)
|
||||
.set({
|
||||
'X-Mashape-Key': process.env.MASHAPE_KEY,
|
||||
'Accept': 'text/plain'
|
||||
});
|
||||
return message.say(`\u180E${response.text}`);
|
||||
}
|
||||
catch (err) {
|
||||
return message.say(':x: Error! Something went wrong!');
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user