qiita_trend
gemを使用したSlack通知用のスクリプトです
まずは通知させるためのSlack Appを作成します。
Slack Appリンクをクリックしてページに遷移して下さい。
Create New App
をクリックします。
App Name
,Development Slack Warkspace
を記述してCreate App
をクリックします。
Incoming Webhooks
をクリックします。
Off→On
に変更し、Add New Webhook to Workspace
をクリックします。
投稿先
を設定してインストールします。
copy
をクリックすることでWebhook用のURLをコピーできます。
config.rb
を書き換えます
WeeklyとMonthlyを使用しない場合はユーザー名とパスワードの設定は必要ありません
# frozen_string_literal: true
require 'qiita_trend'
require './qiita_notifier/configuration'
QiitaNotifier.configure do |config|
# Qiitaでログイン出来るユーザー名とパスワードをセットしてください
config.user_name = 'user_name' ← Qiitaにログインするユーザー名
config.password = 'password' ← Qiitaにログインするパスワード
# Slackで作成したアプリのWebHookURLを設定してください
config.web_hook_url = 'web_hook_url' ← 設定したWebHookURL
# config.channel = '' ⇐ channelを任意選択したい場合に設定してください
end
QiitaTrend.configure do |config|
config.user_name = QiitaNotifier.configuration.user_name
config.password = QiitaNotifier.configuration.password
end
# dailyのトレンドをSlackに通知
$ ruby notify_trend.rb
# dailyのトレンドでNEWのものだけをSlackに通知
$ ruby notify_trend.rb --new
# personalのトレンドをSlackに通知
$ ruby notify_trend.rb -t personal
# personalのトレンドでNEWのものだけをSlackに通知
$ ruby notify_trend.rb -t personal --new