[英]How can I use the `@` symbol in a twitter bot without mentioning a user?
Using twitter in the normal way, you can post an @
symbol without tagging someone by using @@
.以正常方式使用 twitter,您可以发布@
符号,而无需使用@@
标记某人。 Eg @_wurli
would show as a mention, but @@_wurli
, while giving the same text , would not be mention.例如@_wurli
会显示为提及,但@@_wurli
会给出相同的文本,但不会被提及。
I want to know how I can achieve this using a bot.我想知道如何使用机器人实现这一目标。 I am using the {rtweet} package in the R language.我正在使用 R 语言的 {rtweet} package。
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.但是,我发现一个很好的解决方法是在文本的@
和 rest 之间简单地插入一个零宽度空格。 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.但是,如果您只是在每条推文中转换几个字符,这很可能不会成为问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.