twitter-ebooks/skeleton/bots.rb
2014-02-12 16:23:49 +01:00

41 lines
1.2 KiB
Ruby

#!/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