LoginSignup
6
5

More than 5 years have passed since last update.

Ruboty | Ruboty Twitter Adapter でツイートボット を作成 ( ローカル環境確認 ) #ruboty #twitter

Last updated at Posted at 2014-12-12

Ruboty | Ruboty Twitter Adapter で ツイートボット を作成 ( ローカル環境確認 )

概要

Ruboty Twitter Adapter でツイートボットを作成します
( ローカル環境での確認 )

手順

ruboty の generate オプションでひな形を生成します

$ ruboty -g
$ tree
.
┗ ruboty
    ┗ Gemfile

ruboty ディレクトリに移動

$ cd ruboty

Gemfile を確認

$ cat Gemfile
source "https://rubygems.org"

gem "ruboty"

Gemfile を編集

source "https://rubygems.org"

gem "ruboty"
gem "ruboty-twitter"
gem "ruboty-eto"

bundle install で gem をインストール

$ bundle install

.env ファイルを作成し、 ruboty-twitter が利用する環境変数を設定します

TWITTER_CONSUMER_KEY=your_twitter_consumer_key
TWITTER_CONSUMER_SECRET=your_twitter_consumer_secret
TWITTER_ACCESS_TOKEN=your_twitter_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_token_secret

.env ファイルを読み込み、 ruboty を起動します

$ bundle exec ruboty --dotenv

試行

注意点として、 bot 用のアカウントの名前ではなく、
ruboty command 形式で呼び出す必要があります。
※アットマークは無し

ボット用アカウント( tbpgr_bot )で予め tbpgr のアカウントをフォローしておきます。
そして、 tbpgr のアカウントで対象コマンドをツイートします。
すると、 TL のストリームからコマンドを受け取り、 tbpgr_bot が Handler + Action を実行します。

  • tbpgr の tweet
ruboty eto name
  • tbpgr_bot の tweet
  • tbpgr の tweet
ruboty eto emoji
  • tbpgr_bot の tweet
:snake:

画像

tweet_sample.png

補足

ただし、ツイッターは文字数制限や重複投稿への配慮が必要なため、
他のチャットツールと同じ処理のまま Ruboty を利用するには、やや使い勝手が悪いかもしれません。

参照

Ruboty Advent Calendar

明日は @cielavenir さんです。

6
5
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5