Twitter bot for YodaQA written in the Google's App Script. This bot searches Twitter for tweets with
@askYodaQA, takes its text, sends it to YodaQA and reply by answer from it.
Ask bot by tweeting question with
@askYodaQA! Its Twitter account is https://twitter.com/askYodaQA.
You can use hashtags. You can tag other users and they will recieve answer also.
- Create App Script project on the Google Drive
- Copy files from
YodaQATwitterBotfolder to project
- Create two documents on the Google Drive (one is for loging, the second for debuging)
- Copy their ids to
DEBUG_DOCUMENTvariables (Document's id is in the url. https://docs.google.com/spreadsheets/d/1Xn2Q0LnhXHjp0zxMICMjnYKOX3GuLcBC0pzXN7O0eXs/edit#gid=0 has id
- Create spreadsheet with three sheets named
LastQuestion. It will be used as memmory
- Copy its id to
- Add project variables
File - Project Settings - Script variables) from Twitter app setting (which you have to create)
- Add libraries to project (in the
Sources - Libraries)
- (Optional) change YodaQA's endpoint and client urls in the
- Set projects triggers to run
How does it work?
The trigger runs bot every minute. Bot searches for all tweets with
@askYodaQA which has not been founded yet. It parses only question from tweet (deletes
# from hashtags and
@user) and sends it to YodaQA. It saves user, question id, dialog id and tweet id to memmory sheet. It asks YodaQA for answer to all saved questions in the memmory sheet. It send's answer to author and all mentioned users in the tweet, right after the answer is completed.
It supports dialogs. When the question is asked in the interval of five minutes after the last question, than they are connected into one dialog.