mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 05:51:35 +02:00
Movie, TV Show, Yoda Commands
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { MASHAPE_KEY } = process.env;
|
||||
|
||||
module.exports = class YodaCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'yoda',
|
||||
aliases: ['yoda-speak'],
|
||||
group: 'text-edit',
|
||||
memberName: 'yoda',
|
||||
description: 'Converts text to Yoda speak.',
|
||||
args: [
|
||||
{
|
||||
key: 'sentence',
|
||||
prompt: 'What text would you like to convert to Yoda speak?',
|
||||
type: 'string',
|
||||
validate: sentence => {
|
||||
if (sentence.length < 500) return true;
|
||||
return 'Text must be under 500 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const { sentence } = args;
|
||||
const { text } = await snekfetch
|
||||
.get('https://yoda.p.mashape.com/yoda')
|
||||
.query({ sentence })
|
||||
.set({ 'X-Mashape-Key': MASHAPE_KEY });
|
||||
return msg.say(text);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user