Skip to content

Commit

Permalink
Add function to identify known Twitter bots
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Feb 24, 2024
1 parent aa9ad0c commit 3a5f20f
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 9 deletions.
8 changes: 0 additions & 8 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ export const tweetIgnoreList = new Set<string>([
// empty for now
])

// ignore known bots; we don't want them endlessly replying to each other
export const twitterUsersIgnoreList = new Set<string>([
'1598922281434103808', // ChatGPTBot
'1506967793409065000', // ReplyGPT
'1607692579243687936', // ChatSonicAI
'2308326482' // dustyplaylist
])

// Used by the author(s) for faster testing and feedback
export const priorityUsersList = new Set<string>([
'327034465', // transitive_bs
Expand Down
4 changes: 3 additions & 1 deletion src/mentions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as config from './config.js'
import * as db from './db.js'
import * as twitter from './twitter.js'
import type * as types from './types.js'
import { isKnownTwitterBot } from './twitter-known-bots.js'
import { getTwitterUserIdMentions } from './twitter-mentions.js'
import {
getTweetUrl,
Expand Down Expand Up @@ -309,7 +310,8 @@ export async function isValidMention(
return false
}

if (config.twitterUsersIgnoreList.has(mention.author_id!)) {
// Ignore known bots; we don't want them endlessly replying to each other
if (isKnownTwitterBot(mention.author_id!)) {
return false
}

Expand Down
107 changes: 107 additions & 0 deletions src/twitter-known-bots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// These are stored as case-insensitive, lowercase strings
export const twitterKnownBots = new Set<string>(
[
'threadreaderapp',
'SaveToNotion',
'ChatGPTBot',
'AskDexa',
'PingThread',
'readwiseio',
'threader',
'unrollthread',
'ReplyGPT',
'ChatSonicAI',
'dustyplaylist',
'pikaso_me',
'RemindMe_OfThis',
'SaveMyVideo',
'QuotedReplies',
'poet_this',
'MakeItAQuote',
'colorize_bot',
'DearAssistant',
'WhatTheFare',
'wayback_exe',
'TayTweets',
'deepquestionbot',
'MoMARobot',
'phasechase',
'poem_exe',
'desires_exe',
'HundredZeros',
'dscovr_epic',
'MagicRealismBot',
'MuseumBot',
'TwoHeadlines',
'pentametron',
'earthquakebot',
'_grammar_',
'netflix_bot',
'redbox_bot',
'nicetipsbot',
'the_ephemerides',
'year_progress',
'IFindPlanets',
'emojimashupbot',
'translatorbot',
'MetaculusAlert',
'hashtagify',
'GooogleFactss',
'Timer',
'DownloaderBot',
'QuakesToday',
'Savevidbot',
'Growthoid',
'greatartbot',
'Stupidcounter',
'everyword',
'fuckeveryword',
'big_ben_clock',
'LetKanyeFinish',
'RedScareBot',
'EnjoyTheFilm',
'DBZNappa',
'Exosaurs',
'exoslash',
'BloombrgNewsish',
'AutoCharts',
'HottestStartups',
'metaphorminute',
'unchartedatlas',
'YesYoureRacist',
'YesYoureSexist',
'accidental575',
'EarthRoverBot',
'happened_today',
'anagramatron',
'pentametron',
'stealthmountain',
'SortingBot',
'flycolony',
'chernobylstatus',
'blitz_bot_test',
'unescobot',
'wahlumfrageBot',
'NeonaziWallets',
'LatencyAt',
'teololstoy',
'trumpretruth',
'UnrollHelper',
'bot4thread'
].map((s) => s.toLowerCase())
)

export function isKnownTwitterBot(username: string) {
return twitterKnownBots.has(username.toLowerCase())
}

export function isLikelyTwitterBot(username: string) {
username = username.toLowerCase()

if (isKnownTwitterBot(username)) return true
if (/bot$/.test(username)) return true
if (/gpt$/.test(username)) return true
if (/status$/.test(username)) return true

return false
}

0 comments on commit 3a5f20f

Please sign in to comment.