{"id":401,"date":"2020-02-23T23:30:18","date_gmt":"2020-02-23T14:30:18","guid":{"rendered":"https:\/\/blog.hgrs.me\/?p=401"},"modified":"2020-08-07T14:57:12","modified_gmt":"2020-08-07T05:57:12","slug":"minecraft-%e3%81%ae%e3%83%9e%e3%83%ab%e3%83%81%e3%82%b5%e3%83%bc%e3%83%90%e3%81%a7%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3%e9%80%9a%e7%9f%a5%e3%82%92-slack-discord-line-%e3%81%ab%e9%80%81%e3%82%8b","status":"publish","type":"post","link":"https:\/\/blog.hgrs.me\/archives\/401.html","title":{"rendered":"Minecraft \u306e\u30de\u30eb\u30c1\u30b5\u30fc\u30d0\u3067\u30ed\u30b0\u30a4\u30f3\u901a\u77e5\u3092 Slack \/ Discord \/ LINE \u306b\u9001\u308b"},"content":{"rendered":"

\u306f\u3058\u3081\u306b<\/h2>\n

\u7814\u7a76\u5ba4\u306e\u4eba\u305f\u3061\u3068\u30de\u30a4\u30af\u30e9\u306e\u30de\u30eb\u30c1\u3067\u904a\u3093\u3067\u308b\u3093\u3067\u3059\u304c\u3001\u8ab0\u304c\u30a4\u30f3\u3057\u3066\u3044\u308b\u304b\u3092\u77e5\u308a\u305f\u3044\u305f\u3081\u3001\u30ed\u30b0\u30a4\u30f3\u901a\u77e5\u3092\u3064\u3051\u3066\u3044\u307e\u3059\u3002\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u305d\u306e\u65b9\u6cd5\u3092\u516c\u958b\u3057\u307e\u3059\u3002<\/p>\n

\u524d\u63d0\u6761\u4ef6<\/h2>\n

\u901a\u77e5\u3092\u9001\u4fe1\u3059\u308b\u969b\u306b Python \u88fd\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3059\u308b\u306e\u3067 Python \u304c\u4f7f\u7528\u3067\u304d\u308b\u3053\u3068\u304c\u524d\u63d0\u3067\u3059\u3002<\/p>\n

\u50d5\u306e\u74b0\u5883\u306e\u5834\u5408\u306f 3.8.0<\/code> \u3067\u52d5\u4f5c\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

\u5fc5\u8981\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3067\u304d\u307e\u3059\u3002<\/p>\n

pip install pynotificator<\/code><\/pre>\n

\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f PyNotificator \u306f Slack\u3001Discord\u3001LINE \u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u4fe1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u53d7\u3051\u53d6\u308a\u5148\u3092\u6c7a\u3081\u3066\u5fc5\u8981\u306aURL\u3001\u30c8\u30fc\u30af\u30f3\u3092\u4ee5\u4e0b\u304b\u3089\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n

-Slack: Slack API<\/a>
\n-Discord: \u30b5\u30fc\u30d0\u30fc\u8a2d\u5b9a > \u30a6\u30a7\u30d6\u30d5\u30c3\u30af \u3088\u308a\u3001Webhook \u7528\u306e URL \u3092\u53d6\u5f97
\n-LINE:
LINE Notify<\/a><\/p>\n

\u901a\u77e5\u7528\u306e\u30b9\u30af\u30ea\u30d7\u30c8<\/h2>\n

\u30de\u30a4\u30af\u30e9\u306e\u30b5\u30fc\u30d0\u5b9f\u884c\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089\u30d1\u30a4\u30d7\u3067\u901a\u77e5\u7528\u30b3\u30de\u30f3\u30c9\u306b\u30ed\u30b0\u3092\u6d41\u3057\u307e\u3059\u3002<\/p>\n

\u5b9f\u884c\u30b3\u30de\u30f3\u30c9\u306e\u5927\u67a0\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n

<\u30de\u30a4\u30af\u30e9\u306e\u30b5\u30fc\u30d0\u5b9f\u884c\u30b3\u30de\u30f3\u30c9> | while read -r line\ndo\n  if [[ $line == *joined\\ the\\ game* ]]; then echo "${line:33}" | <slack|discord|line>-notify -m "$(cut -d ' ' -f 1) \u304c\u30ed\u30b0\u30a4\u30f3\u3057\u307e\u3057\u305f\u3002" <URL|token> ; fi\n  if [[ $line == *left\\ the\\ game* ]]; then echo "${line:33}" | <slack|discord|line>-notify -m "$(cut -d ' ' -f 1) \u304c\u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u307e\u3057\u305f\u3002" <URL|token> ; fi\ndone;<\/code><\/pre>\n

\u3053\u308c\u3092\u3082\u3068\u306b Slack \u304b Discord \u304b LINE \u3092\u9078\u629e\u3057\u3066\u3001\u4e0a\u8a18\u306e <><\/code> \u3067\u56f2\u307e\u308c\u305f\u90e8\u5206\u3092\u66f8\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002
\n\u4f8b\u3048\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30de\u30f3\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n

java -jar server.jar nogui | while read -r line\ndo\n  if [[ $line == *joined\\ the\\ game* ]]; then echo "${line:33}" | slack-notify -m "$(cut -d ' ' -f 1) \u304c\u30ed\u30b0\u30a4\u30f3\u3057\u307e\u3057\u305f\u3002" https:\/\/hooks.slack.com\/services\/xxx ; fi\n  if [[ $line == *left\\ the\\ game* ]]; then echo "${line:33}" | slack-notify -m "$(cut -d ' ' -f 1) \u304c\u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u307e\u3057\u305f\u3002" https:\/\/hooks.slack.com\/services\/yyy ; fi\ndone;<\/code><\/pre>\n

\u52d5\u4f5c\u4f8b<\/h2>\n

\u50d5\u306e\u74b0\u5883\u3067\u306f Discord\u306b\u9001\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n

\"\"<\/p>\n

\u3061\u306a\u307f\u306b\u3001\u3053\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5c11\u3057\u5fdc\u7528\u3059\u308b\u3068\u3001\u6b7b\u4ea1\u901a\u77e5\u306a\u3069\u3082\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n

\"\"<\/p>\n

\u304a\u308f\u308a\u306b<\/h2>\n

\u60c5\u5831\u7cfb\u306e\u7814\u7a76\u5ba4\u3063\u307d\u304f\u3001\u30de\u30a4\u30af\u30e9\u3092\u3084\u308b\u74b0\u5883\u3082\u3069\u3093\u3069\u3093\u4fbf\u5229\u306b\u3057\u3066\u3044\u304d\u305f\u3044\u3067\u3059\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u306f\u3058\u3081\u306b \u7814\u7a76\u5ba4\u306e\u4eba\u305f\u3061\u3068\u30de\u30a4\u30af\u30e9\u306e\u30de\u30eb\u30c1\u3067\u904a\u3093\u3067\u308b\u3093\u3067\u3059\u304c\u3001\u8ab0\u304c\u30a4\u30f3\u3057\u3066\u3044\u308b\u304b\u3092\u77e5\u308a\u305f\u3044\u305f\u3081\u3001\u30ed\u30b0…<\/p>\n","protected":false},"author":1,"featured_media":404,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[37,14,26],"_links":{"self":[{"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/posts\/401"}],"collection":[{"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/comments?post=401"}],"version-history":[{"count":0,"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/posts\/401\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/media\/404"}],"wp:attachment":[{"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/media?parent=401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/categories?post=401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hgrs.me\/wp-json\/wp\/v2\/tags?post=401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}