Bad Pun Bot

John C


It has stopped being active on Twitter due to the new policy Elon Musk brought to Twitter. It might moved to Mastodon in the future.

Artistic Description

Let’s talk about how this bot work first. Basically it track the political figures’ personal accounts on twitter, like @RealDonaldTrump, when any of them tweet something, the bot will got the tweet, make bad pun from it (changing some words in the tweet to words that sound similar but have different meaning – this explanation is a little bit redundant, just like the bot itself)

Anyway, this bot will track political figures from the US, Europe, Canada, Asia, basically all over the world ( if the figure using English to tweet – there is some technical challenges that I can’t solve yet for other languages, so maybe other political figures need to wait for some time). At first it will track Papa Francisco too but later I realised that it’s a terrible idea. I really want to track some officers in HKGov but it seems that they don’t use twitter, what a pity.

There are lots of crap above, sorry for that and thank you for reading to here. The inspiration for the bot comes from the memes that make fun of Donald Trump’s accent, so I think it will be super funny to make puns from what the political figures say on social media, and the result is very interesting. One output from my early experiment is “Iran is going to make a ‘sing attack’ to America”, and that’s a awesome sentence, originally from Trump’s tweet that says Iran is going to make a sneak attack.

I am a chaotic evil person, I basically hate all political figures in the world (I hope that does not offend you). So you can say that the bot is a reflection of myself, making fun of those nationalism, conservatism speeches. But anyway I will keep claiming that this is just for fun, to avoid any trouble.

Technical Description

I use a metaphone algorithm to do the swap of words, and that’s from the natural library. So that’s almost all the code is about, plus some code to tidy up the retrieved tweets and the generated new tweets.

The bot


Github Repo




Use RiTa, RiTwit, Natural, Express libraries. Hosting on Heroku.