tl;dr
I spoke at a LondonR hootenanny1 (in-person!) about how to create your own simple Twitter bot powered by GitHub Actions and {rtweet}, just like my @londonmapbot creation.
The mapbotverse
I created a Twitter bot called @londonmapbot. It uses the {rtweet} package by Mike Kearney to tweet out a random satellite image of Greater London via Mapbox, scheduled and executed by GitHub Actions.
I’ve written about this before:
- A Twitter bot with {rtweet} and GitHub Actions (original post)
- Mapping londonmapbot tweets with {leaflet}
- What colour is London?
I’ve noticed a number of other projects have used or developed the londonmapbot code, or else are inspired by it. I’ve created a Twitter List containing the ones I know about, which—in earnest—I’ve called ‘the mapbotverse’.
It includes bots that tweet maps more cleverly, or do something else, like:
- Roberto Jiménez’s @esmapbot, which tweets images of Spain sampled from within a geojson of the country’s borders
- Matt Kerlogue’s @narrowbotR, which tweets canal and river locations with geographically-coincident Flickr images, which have been rated for photo quality (!)
- Oscar Baruffa’s @BigBookofR, which tweets out a random section of the excellent Big Book of R resource
I talked at LondonR about how you can be at least as cool as these folks.
Yes, you too can fork the source for londonmapbot on GitHub, or click the green ‘use this template’ button in the repo to begin your own mapbot. Or you can can create something from scratch. Let me know what you get up to.
Slides
Obviously I created some slides for the event. Consider them a more up-to-date (and simpler) version of my original blogpost.
Below is the presentation embedded2, but you can also visit the slides online, or go to the source on GitHub.
With the slides selected, press the left and right keys to navigate, F to go fullscreen and P to see the presenter notes.
Bonus
Just after the talk, I found out I could mark the bot as ‘automated’ from Twitter settings at: More > Settings and Privacy > Your account > Account information > Automation. I just had to log in as the ‘managing account’ (i.e. my personal account) to connect the two profiles. This is now required as per terms of service, I believe.
So now the profile has a little robot icon and the phrase ‘automated by @mattdray’.
Inevitable bot uprising
It’s another maybe two-or-so years until all of Twitter (Earth?) is just a bot singularity, so I suggest you get in early. I reckon a mapbot is a pretty cheap way to get in on the hype.
Session info
## ─ Session info ───────────────────────────────────────────────────────────────
## setting value
## version R version 4.1.0 (2021-05-18)
## os macOS Big Sur 10.16
## system x86_64, darwin17.0
## ui X11
## language (EN)
## collate en_GB.UTF-8
## ctype en_GB.UTF-8
## tz Europe/London
## date 2022-02-19
##
## ─ Packages ───────────────────────────────────────────────────────────────────
## package * version date lib
## blogdown 1.4 2021-07-23 [1]
## bookdown 0.23 2021-08-13 [1]
## bslib 0.3.1 2021-10-06 [1]
## cli 3.1.0 2021-10-27 [1]
## digest 0.6.29 2021-12-01 [1]
## evaluate 0.14 2019-05-28 [1]
## fastmap 1.1.0 2021-01-25 [1]
## htmltools 0.5.2 2021-08-25 [1]
## jquerylib 0.1.4 2021-04-26 [1]
## jsonlite 1.7.3 2022-01-17 [1]
## knitr 1.37 2021-12-16 [1]
## magrittr 2.0.2 2022-01-26 [1]
## R6 2.5.1 2021-08-19 [1]
## rlang 1.0.1 2022-02-03 [1]
## rmarkdown 2.10 2021-08-06 [1]
## rstudioapi 0.13 2020-11-12 [1]
## sass 0.4.0 2021-05-12 [1]
## sessioninfo 1.1.1 2018-11-05 [1]
## stringi 1.7.6 2021-11-29 [1]
## stringr 1.4.0 2019-02-10 [1]
## withr 2.4.3 2021-11-30 [1]
## xaringanExtra 0.5.5 2022-02-12 [1]
## xfun 0.29 2021-12-14 [1]
## yaml 2.2.2 2022-01-25 [1]
## source
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.2)
## CRAN (R 4.1.0)
## CRAN (R 4.1.2)
## CRAN (R 4.1.0)
## CRAN (R 4.1.2)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## CRAN (R 4.1.0)
## Github (gadenbuie/xaringanExtra@ee5092d)
## CRAN (R 4.1.0)
## CRAN (R 4.1.2)
##
## [1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library
Past tense, unless you are reading this before 2022-02-17, in which case you are very keen. Well done, 10 points to Hufflepuff!f↩︎
Hi again to folks reading this before the event has happened. The slides are basically finished, but I may tweak them before the actual event. In which case what you see here may change slightly before the big day. Another 10 points to Hufflepuff!↩︎