Replace twit with my own module, node-tweet

This commit is contained in:
TheEssem 2020-03-14 18:03:45 -05:00
parent fd5575dcea
commit 93a7b3fa0d
5 changed files with 44 additions and 406 deletions

View file

@ -3,9 +3,10 @@ const twitter = require("../utils/twitter.js");
exports.run = async (message, args) => {
if (message.author.id !== process.env.OWNER) return `${message.author.mention}, only the bot owner can tweet!`;
if (args.length === 0) return `${message.author.mention}, you need to provide some text to tweet!`;
const info = await twitter.client.post("statuses/update", { status: args.join(" ") });
if (info.resp.statusCode !== 200) return `Something happened when trying to post this tweet: ${info.resp.statusCode} ${info.resp.statusMessage}`;
return `${message.author.mention}, a tweet with id ${info.data.id_str} has been posted with status code ${info.resp.statusCode} ${info.resp.statusMessage}.`;
const info = await twitter.client.statuses.update(args.join(" "));
//if (info.resp.statusCode !== 200) return `Something happened when trying to post this tweet: ${info.resp.statusCode} ${info.resp.statusMessage}`;
return `https://twitter.com/${process.env.HANDLE}/status/${info.id_str}`;
// with status code ${info.resp.statusCode} ${info.resp.statusMessage}.
};
exports.category = 7;