Need to finish this command

This commit is contained in:
Loic Bersier 2019-02-24 15:47:19 +01:00
parent 2470722731
commit bab84c7890
2 changed files with 57 additions and 0 deletions

56
commands/general/twitter.js Executable file
View file

@ -0,0 +1,56 @@
//TODO
//FIX INDENT
//PUT TWITTER KEY ON CONFIG.JSON
//SEND FEEDBACK ONCE THE COMMAND HAVE BEEN EXECUTED
const { Command } = require('discord-akairo');
const Twitter = require('twitter');
const rand = require('../../rand.js');
class twitterCommand extends Command {
constructor() {
super('twitter', {
aliases: ['twitter'],
category: 'general',
args: [
{
id: 'text',
type: 'string',
match: 'rest'
}
],
description: {
content: 'Send tweet from Haha yes twitter account',
usage: '[text]',
examples: ['this epic tweet is in my epic twitter']
}
});
}
async exec(message, args) {
let client = new Twitter({
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
});
let text = args.text;
if (!text)
return;
text = rand.random(text, message);
client.post('statuses/update', {status: 'test'}, function(error, tweet, response) {
if (!error) {
console.log(tweet);
}
console.log(response);
});
// Send the final text
return message.channel.send('epic');
}
}
module.exports = twitterCommand;

View file

@ -14,6 +14,7 @@
"node-fetch": "^2.3.0", "node-fetch": "^2.3.0",
"reload-json": "^0.3.1", "reload-json": "^0.3.1",
"superagent": "^4.1.0", "superagent": "^4.1.0",
"twitter": "^1.7.1",
"youtube-dl": "^1.12.2" "youtube-dl": "^1.12.2"
}, },
"devDependencies": { "devDependencies": {