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
1 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,8 @@ module.exports = async () => {
// tweet stuff
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 tweets = (await database.tweets.find({ enabled: true }).exec())[0];
const tweetContent = await misc.getTweet(tweets);
@ -58,6 +59,7 @@ module.exports = async () => {
track: `@${process.env.HANDLE}`
});
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)) {
const tweets = (await database.tweets.find({ enabled: true }).exec())[0];
let tweetContent;