Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新型コロナ調査ちゃんに知能を芽生えさせる #202

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions slack-bot/url-vote-map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ts=`date '+%s'`
. ./lib/slack-helper.sh
. ./lib/url-helper.sh
. ./lib/redis-helper.sh
. ./lib/auto-ml-helper.sh

namespace="vscovid-crawler-vote"

Expand All @@ -20,13 +21,30 @@ send_message() {
# キューから一件取り出す
value=`redis_pop_value_from_queue $namespace`
value=`echo $value| cut -d' ' -f 2`
echo $value
url=`echo $value| cut -d',' -f 1`
title=`get_title_by_url ${url}`

if [[ $title == "" ]];then
return 1
fi

predict=`get_predict_by_url $url`
predict_label=`echo $predict | cut -d',' -f 1`
echo $predict_label
predict_score=`echo $predict | cut -d',' -f 2`
set +e
predict_score=$(echo "$predict_score*100" | bc | cut -d'.' -f 1)
set -e
if [[ $predict_label == "\"not_covid19_help\"" ]];then
if [ $predict_score -gt 60 ];then
return 1
fi
fi

user_id=`echo $value| cut -d',' -f 2`
timestamp=`echo $value| cut -d',' -f 3`
result=`echo $value| cut -d',' -f 4`

title=`get_title_by_url ${url}`
orgname=`get_orgname_by_url ${url}`

md5=`get_md5_by_url $url`
Expand All @@ -47,7 +65,7 @@ send_message() {
"type": "section",
"text": {
"type": "mrkdwn",
"text": "新型コロナに関連する経済支援制度を収集しています!"
"text": "あなたはこのURLは自治体独自の新型コロナ関連経済支援制度だと思いますか?"
}
},
{
Expand Down Expand Up @@ -126,20 +144,17 @@ send_message() {
}
EOF
`
echo $json | jq .
wget -q -O - --post-data "$json" \
wget -q -O /dev/null --post-data "$json" \
--header="Content-type: application/json" \
--header="Authorization: Bearer ${slack_token}" \
https://slack.com/api/chat.postMessage | jq .
https://slack.com/api/chat.postMessage
echo ""
}

main() {
channels_id=`get_channels_id`
members_list=`get_members_list $channels_id`

echo members num ${#members_list[@]}

# 一秒に一回でいい
# 各メンバーにDMを送る
# テスターのID
Expand Down