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"
}
您好,我遇到了错误,并且我试图通过不和谐鸣叫,以便我和我的朋友可以使用同一个帐户来取乐。请帮助我,我是初学者,不知道问题出在哪里...