Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
mmasaki committed Dec 3, 2019
1 parent 7aa0c30 commit dcb6e38
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
26 changes: 26 additions & 0 deletions README.md
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ファイルの例です。
11 changes: 8 additions & 3 deletions eew.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dcb6e38

Please sign in to comment.