Commit 67739fb7 authored by nanahira's avatar nanahira

fuck musk ban tweet

parent 5784df90
...@@ -104,14 +104,14 @@ export default class RetweetNotifierPlugin extends SchedulePlugin( ...@@ -104,14 +104,14 @@ export default class RetweetNotifierPlugin extends SchedulePlugin(
async send() { async send() {
let { data: tweets } = await this.http.post<{ data: Tweet[] }>( let { data: tweets } = await this.http.post<{ data: Tweet[] }>(
this.config.endpoint + '/Search', this.config.endpoint + '/Profile',
{ {
Username: this.config.username, Username: this.config.username,
Since: moment() Since: moment()
.subtract(this.config.traceDays, 'days') .subtract(this.config.traceDays, 'days')
.utc() .utc()
.format('YYYY-MM-DD HH:mm:ss'), .format('YYYY-MM-DD HH:mm:ss'),
Search: this.config.search || undefined, // Search: this.config.search || undefined,
}, },
{ {
headers: { headers: {
...@@ -120,9 +120,12 @@ export default class RetweetNotifierPlugin extends SchedulePlugin( ...@@ -120,9 +120,12 @@ export default class RetweetNotifierPlugin extends SchedulePlugin(
}, },
); );
// tweets = tweets.filter((t) => t.retweets_count === 0); // notify non-retweets only // tweets = tweets.filter((t) => t.retweets_count === 0); // notify non-retweets only
tweets = await asyncFilter(tweets, (tweet) => tweets = await asyncFilter(tweets, (tweet) => {
this.notNotified(tweet.id_str), 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; if (!tweets.length) return;
const leastRetweet = _.minBy( const leastRetweet = _.minBy(
tweets, 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