Я создаю бота, чтобы ответить на определенные слова (обозначенные вероятные слова «тролль») с цитатами из George Orwell роман с использованием рубинового драгоценного камня «twitter». На данный момент мой код выглядит следующим образом:ruby twitter gem: тактический ответ от опроса-тролля, но timeline не показывает твит ответил
require 'yaml'
require 'twitter'
require 'thor'
require 'httparty'
require 'colorize'
puts '\|/|\|/'.red + ' Loading anti-troll tactical auto-canon! '.blue + '\|/|\|/'.red + "\n"
trollWords = ['Satan', 'Trump tower', 'libtard', 'nihilism', 'alt-right', 'feminazi', 'genocide', 'gulag', 'trigger-warning', 'special snowflake', 'privilege', 'ugly', 'moron', 'block-list', 'nazi']
quotes = ['Perhaps one did not want to be loved so much as to be understood.', 'Who controls the past controls the future. Who controls the present controls the past.', 'War is peace. Freedom is slavery. Ignorance is strength.', 'The best books... are those that tell you what you know already.', 'If you want to keep a secret, you must also hide it from yourself.', 'If you want a picture of the future, imagine a boot stamping on a human face — forever.', 'We shall meet in the place where there is no darkness.', 'But if thought corrupts language, language can also corrupt thought.', 'Doublethink means the power of holding two contradictory beliefs in one\'s mind simultaneously, and accepting both of them.', 'Until they became conscious they will never rebel, and until after they have rebelled they cannot become conscious.', 'The Party seeks power entirely for its own sake.', 'Russian Communists came very close to us in their methods, but they never had the courage to recognize their own motives.', 'Perhaps a lunatic was simply a minority of one.', 'If you loved someone, you loved him, and when you had nothing else to give, you still gave him love.', 'In the face of pain there are no heroes.', 'Big Brother is Watching You.', 'Reality exists in the human mind, and nowhere else.', 'Orthodoxy means not thinking--not needing to think. Orthodoxy is unconsciousness.', 'Nothing was your own except the few cubic centimetres inside your skull.', 'Confession is not betrayal.', 'Sanity is not statistical.']
client = Twitter::REST::Client.new do |config|
config.consumer_key = '[key]'
config.consumer_secret = '[secret]'
config.access_token = '[token]'
config.access_token_secret = '[token secret]'
end
word = trollWords.sample
quote = quotes.sample
def output_init_string(word, quote)
puts "Troll identification word: " + word + ".\n" + "Response quote: " + quote
end
client.search(word, count: 10).each do |t|
quote = quotes.sample
word = trollWords.sample
replystring = "@" + t.user.screen_name + " " + quote
puts "Found possible troll suspect: " + t.user.screen_name + "\nTweeting: " + t.text + "\nReplied with: " + replystring + "\n"
client.update(replystring, in_reply_to_status_id: t)
sleep(300)
end
И это действительно работает, но когда я расширяю детали на ответ, я не могу увидеть оригинальный твит, только ответ моего бота и @ [пользователь]. Может ли кто-нибудь сказать мне, как сделать так, чтобы твитер оригинального пользователя был виден на деталях? Так, например, в консоли вывода я вижу:
Но если я нажимаю на ответ моего бота, я просто вижу:
В https://twitter.com/bravebot1984/status/832328576619921413 без указания того, что твит был в ответ.
Этот вопрос не является дубликатом связанного с вопросом, так как я уже использую метод, предложенный для ответа, и метод приводит к ответу сортировок, но он не отображается должным образом подробно. , поскольку мне это нужно.
Возможный дубликат [Как ответить на твиттере, используя камень Twitter] (http://stackoverflow.com/questions/28649582/ how-to-reply-a-tweet-using-the-twitter-gem) –
Не дубликат, поскольку я уже использую метод, предложенный в ответах на этот вопрос. Этот вопрос отличается от того, что он не спрашивает «как ответить», но «как правильно ответить на ответ, чтобы ответить на твит по подробному расширению». –