-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# slack-eew | ||
|
||
緊急地震速報をslackに通知します。 | ||
ウェザーニュースの契約が必要です | ||
|
||
## 設定 | ||
|
||
eew.rbの定数を編集してください。 | ||
|
||
``` | ||
UserID: ウェザーニュースのID | ||
Password: ウェザーニュースのパスワード | ||
SlackToken: slackのtoken (legacy token?) | ||
Channel: 通知するchannel | ||
SlackUsername: 通知で表示されるユーザ名 | ||
IconURL: 通知のアイコンのURL | ||
``` | ||
|
||
## 起動 | ||
|
||
``` | ||
bundle exec ruby eew.rb | ||
``` | ||
|
||
eew.serviceはSystemdのUnitファイルの例です。 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,19 +7,24 @@ | |
require "slack-ruby-client" | ||
require "lru_redux" | ||
|
||
ServerListURL = "http://lst10s-sp.wni.co.jp/server_list.txt" | ||
UserID = "[email protected]" # WNI | ||
# WNI | ||
UserID = "[email protected]" | ||
Password = "changeme" | ||
ServerListURL = "http://lst10s-sp.wni.co.jp/server_list.txt" | ||
|
||
# Slack | ||
SlackToken = "token" | ||
Channel = "#channel" | ||
SlackUsername = "緊急地震速報" | ||
IconURL = "https://slack-files2.s3-us-west-2.amazonaws.com/avatars/2018-06-18/383300443972_adff82647cf3967cb337_72.png" | ||
|
||
DEBUG = true | ||
|
||
trap(:INT) { exit } | ||
STDOUT.sync = true | ||
@logger = Logger.new(STDOUT) | ||
|
||
client = Slack::Web::Client.new(token: "token") | ||
client = Slack::Web::Client.new(token: SlackToken) | ||
@cache = LruRedux::TTL::Cache.new(8, 300) | ||
|
||
def get_server | ||
|