const Discord = require('discord.js');
const Commando = require('discord.js-commando');
const Twitter = require('twitter');
const config = require("../config.json");
const clientTwitter = new Twitter({
consumer_key: config.twitterConsumerKey,
consumer_secret: config.twitterConsumerSecret,
access_token_key: config.twitterAccessKey,
access_token_secret: config.twitterAccessSecret
});
module.exports.run = async(client, message, args) => {
try {
// Checks the guild and only allows commands from trusted guild. Define in config.json
if(message.guild.id === config.myGuildID) {
if(args === undefined){
message.channel.send("You must write something :thinking:");
} else {
var argR = args;
clientTwitter.post('statuses/update', {status: argR}, function(error, tweet, response) {
if (!error) {
message.channel.send("Tweeted :notes:");
} else {
message.channel.send(":x: Error");
}
});
}
} else{
message.channel.send("Command not allowed in this guild :angry:");
}
} catch(e) {
console.log(e);
}
}
module.exports.help = {
name: "tweet"
}
Hello I am getting errors and im trying to tweet via discord so me and my friends could use a same account for fun.Help me please ,I am a beginner and I don't know where the problem is...