Using twitter in the normal way, you can post an @
symbol without tagging someone by using @@
. E.g. @_wurli
would show as a mention, but @@_wurli
, while giving the same text, would not be mention.
I want to know how I can achieve this using a bot. I am using the {rtweet} package in the R language.
I'm not sure whether or not there's an intended approach to for dealing with these. However, a good workaround I've found is to simply insert a zero-width space between the @
and the rest of the text. This also works for hashtags:
tweets <- c("@not_a_user", "#notatag")
zero_width_space <- "\U200B"
tweets <- tweets |>
gsub(x = _, "@", paste0("@", zero_width_space)) |>
gsub(x = _, "#", paste0("#", zero_width_space))
The only potential issue is that this adds to the number of characters in the tweet. However if you're only transforming a few characters per tweet this is most likely not going to be an issue.