Commit 67739fb7 authored by nanahira's avatar nanahira

fuck musk ban tweet

parent 5784df90
......@@ -104,14 +104,14 @@ export default class RetweetNotifierPlugin extends SchedulePlugin(
async send() {
let { data: tweets } = await this.http.post<{ data: Tweet[] }>(
this.config.endpoint + '/Search',
this.config.endpoint + '/Profile',
{
Username: this.config.username,
Since: moment()
.subtract(this.config.traceDays, 'days')
.utc()
.format('YYYY-MM-DD HH:mm:ss'),
Search: this.config.search || undefined,
// Search: this.config.search || undefined,
},
{
headers: {
......@@ -120,9 +120,12 @@ export default class RetweetNotifierPlugin extends SchedulePlugin(
},
);
// tweets = tweets.filter((t) => t.retweets_count === 0); // notify non-retweets only
tweets = await asyncFilter(tweets, (tweet) =>
this.notNotified(tweet.id_str),
);
tweets = await asyncFilter(tweets, (tweet) => {
if (tweet.reply_to?.length || tweet.tweet.startsWith('RT')) return false; // ignore replies and retweets
if (this.config.search && !tweet.tweet.includes(this.config.search))
return false; // ignore tweets not containing search keyword
return this.notNotified(tweet.id_str);
});
if (!tweets.length) return;
const leastRetweet = _.minBy(
tweets,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment