Made the twitter bot not reply to blocked users (for real this time)

This commit is contained in:
TheEssem 2019-12-29 15:11:58 -06:00
parent 1fddd58059
commit 641cea664c

View file

@ -35,7 +35,8 @@ module.exports = async () => {
// tweet stuff // tweet stuff
if (twitter !== null && twitter.active === false) { if (twitter !== null && twitter.active === false) {
const blocks = await twitter.client.get("blocks/ids"); const blocks = await twitter.client.get("blocks/ids", { stringify_ids: true });
console.log(blocks.data);
const tweet = async () => { const tweet = async () => {
const tweets = (await database.tweets.find({ enabled: true }).exec())[0]; const tweets = (await database.tweets.find({ enabled: true }).exec())[0];
const tweetContent = await misc.getTweet(tweets); const tweetContent = await misc.getTweet(tweets);
@ -58,6 +59,7 @@ module.exports = async () => {
track: `@${process.env.HANDLE}` track: `@${process.env.HANDLE}`
}); });
stream.on("tweet", async (tweet) => { stream.on("tweet", async (tweet) => {
console.log(tweet.user.id_str);
if (tweet.user.screen_name !== "esmBot_" && !blocks.data.ids.includes(tweet.user.id_str)) { if (tweet.user.screen_name !== "esmBot_" && !blocks.data.ids.includes(tweet.user.id_str)) {
const tweets = (await database.tweets.find({ enabled: true }).exec())[0]; const tweets = (await database.tweets.find({ enabled: true }).exec())[0];
let tweetContent; let tweetContent;