Sha256: 3a2e290ddb949b02288f1c07a3b5bf40524d0dd2dd764769b9b9606135d45db3
Contents?: true
Size: 1.27 KB
Versions: 4
Compression:
Stored size: 1.27 KB
Contents
#!/usr/bin/env ruby require 'twitter_ebooks' # This is an example bot definition with event handlers commented out # You can define as many of these as you like; they will run simultaneously Ebooks::Bot.new("{{BOT_NAME}}") do |bot| # Consumer details come from registering an app at https://dev.twitter.com/ # OAuth details can be fetched with https://github.com/marcel/twurl bot.consumer_key = "" # Your app consumer key bot.consumer_secret = "" # Your app consumer secret bot.oauth_token = "" # Token connecting the app to this account bot.oauth_token_secret = "" # Secret connecting the app to this account bot.on_message do |dm| # Reply to a DM # bot.reply(dm, "secret secrets") end bot.on_follow do |user| # Follow a user back # bot.follow(user[:screen_name]) end bot.on_mention do |tweet, meta| # Reply to a mention # bot.reply(tweet, meta[:reply_prefix] + "oh hullo") end bot.on_timeline do |tweet, meta| # Reply to a tweet in the bot's timeline # bot.reply(tweet, meta[:reply_prefix] + "nice tweet") end bot.scheduler.every '24h' do # Tweet something every 24 hours # See https://github.com/jmettraux/rufus-scheduler # bot.tweet("hi") end end EM.run do Ebooks::Bot.all.each do |bot| bot.start end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
twitter_ebooks-2.0.3 | skeleton/bots.rb |
twitter_ebooks-2.0.2 | skeleton/bots.rb |
twitter_ebooks-2.0.1 | skeleton/bots.rb |
twitter_ebooks-2.0.0 | skeleton/bots.rb |