Lingr に定期的につぶやきます。
Last active
December 10, 2015 03:08
-
-
Save hrysd/4372418 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source :rubygems | |
| gem 'clockwork' | |
| gem 'heroku' | |
| gem 'active_support' | |
| gem 'lingman', git: 'git://github.com/hrysd/lingman.git' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| clock: bundle exec clockwork clock.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment