Skip to content

Instantly share code, notes, and snippets.

@hrysd
Last active December 10, 2015 03:08
Show Gist options
  • Select an option

  • Save hrysd/4372418 to your computer and use it in GitHub Desktop.

Select an option

Save hrysd/4372418 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require 'clockwork'
require 'lingman'
require 'active_support/time'
def work_or_study
time = ((Time.now.beginning_of_week - Time.new('1970 00:00:00')) / 60 / 60 / 24 / 7).to_i
week = time.even? ? "学習" : "作業"
"今日は#{week}週です。"
end
module Clockwork
handler do |job|
puts "#{job}"
Lingman::Updater.update(ENV['BOTID'], ENV['ROOMID'], ENV['SECRET'], work_or_study)
end
every(1.day, 'work_or_study', at: '10:00')
every(1.day, 'work_or_study', at: '21:00')
end

Lingr に定期的につぶやきます。

source :rubygems
gem 'clockwork'
gem 'heroku'
gem 'active_support'
gem 'lingman', git: 'git://github.com/hrysd/lingman.git'
clock: bundle exec clockwork clock.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment