Skip to content

Instantly share code, notes, and snippets.

@toshia
Last active January 11, 2018 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toshia/1306093 to your computer and use it in GitHub Desktop.
Save toshia/1306093 to your computer and use it in GitHub Desktop.
自動的によるほーする例。でもよるほーは手動でやれよ
# -*- coding: utf-8 -*-
# say "よるほー"
# よるほーの例です。あくまでReserverのデモンストレーション用に作りました。
# なので実戦投入はしないこと。よるほーは自分でタイミングを合わせることにこそ意義があるのです。
Plugin.create(:yoruho) do
class << self
def main
Reserver.new(nextyrhtime){
say_yoruho()
sleep 1
main } end
# 次回のよるほー時間を取得
def nextyrhtime
now = Time.new
result = Time.local(now.year, now.month, now.day, 0, 0)
while result < now
result += 86400 end
result end
# よるほーとつぶやく
def say_yoruho()
world, = Plugin.filtering(:world_current, nil)
compose(world, message: 'ておほー') end
end
main
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment