{"id":894,"date":"2019-05-19T16:15:28","date_gmt":"2019-05-19T07:15:28","guid":{"rendered":"https:\/\/ito-u-oti.com\/?p=894"},"modified":"2021-04-11T23:01:27","modified_gmt":"2021-04-11T14:01:27","slug":"post-894","status":"publish","type":"post","link":"https:\/\/ito-u-oti.com\/?p=894","title":{"rendered":"Google Apps Script\u3067Discord\u306bbot\u3092\u4f5c\u308b"},"content":{"rendered":"\n<p>Slack\u3068\u540c\u3058Electron\u3067\u51fa\u6765\u3066\u3044\u308bDiscord\u306fSlack\u306ebot\u306e\u4f5c\u308a\u65b9\u3068\u89aa\u548c\u6027\u304c\u9ad8\u304f\u3001\u307b\u3068\u3093\u3069\u540c\u3058\u3088\u3046\u306bDiscord\u7528\u306ebot\u3092\u4f5c\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br>\u4eca\u56de\u306fFPS\u30b2\u30fc\u30e0\u3067\u3042\u308bApex Legends\u306e\u30c7\u30fc\u30bf\u30c8\u30e9\u30c3\u30ab\u30fc\u3092\u5229\u7528\u3057\u3066Discord\u306bbot\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<h2 id=\"outline__1\" class=\"wp-block-heading\">\u6982\u8981<\/h2>\n\n\n\n<p>\u3042\u308b\u6642\u9593\u306b\u306a\u308b\u3068GAS\u304cApex Legends\u306e\u30d7\u30ec\u30a4\u30e4\u30fc\u30c7\u30fc\u30bf\u3092TRN\u304b\u3089\u53d6\u5f97\u3057\u3001Discord\u306b\u6295\u7a3f\u3059\u308b<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord1-1.png\" alt=\"\" class=\"wp-image-896\" width=\"495\" height=\"259\"\/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>\u30c8\u30ea\u30ac\u30fc\u304c\u5b9f\u884c\u3055\u308c\u308b\u3002<\/li><li>TRN\u304b\u3089Apex Legends\u306e\u30d7\u30ec\u30a4\u30e4\u30fc\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3002<\/li><li>\u30d7\u30ec\u30a4\u30e4\u30fc\u30c7\u30fc\u30bf\u3092Discord\u306bPOST\u3059\u308b\u3002<\/li><li>Discord\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u6295\u7a3f\u3055\u308c\u308b\u3002<\/li><\/ol>\n\n\n\n<p>\u5b8c\u6210\u30a4\u30e1\u30fc\u30b8\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<br>embed\u3068\u3044\u3046\u5f62\u5f0f\u3067\u6295\u7a3f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord2.png\" alt=\"\" class=\"wp-image-897\" width=\"566\" height=\"717\"\/><\/figure>\n\n\n\n<p>\u307e\u305f\u3001embed\u3092\u4f7f\u308f\u306a\u3044\u666e\u901a\u306e\u6295\u7a3f\u3082\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord3.png\" alt=\"\" class=\"wp-image-898\" width=\"565\" height=\"573\"\/><\/figure>\n\n\n\n<h2 id=\"outline__2\" class=\"wp-block-heading\">\u4f5c\u6210<\/h2>\n\n\n\n<h3 id=\"outline__2_1\" class=\"wp-block-heading\">TRN\u3067\u306eApex tracker\u306e\u4f7f\u3044\u65b9<\/h3>\n\n\n\n<p>\u73fe\u5728Apex Legends\u306f\u516c\u5f0f\u306e\u30c7\u30fc\u30bf\u30c8\u30e9\u30c3\u30af\u7528API\u3092\u516c\u958b\u3057\u3066\u3044\u307e\u305b\u3093\u304c\u3001<a href=\"https:\/\/apex.tracker.gg\/\">TRN<\/a>\u3068\u3044\u3046\u30c7\u30fc\u30bf\u30c8\u30e9\u30c3\u30af\u7528\u306e\u30b5\u30a4\u30c8\u3092\u7d4c\u7531\u3057\u3066\u30d7\u30ec\u30a4\u30e4\u30fc\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br><a href=\"https:\/\/apex.tracker.gg\/site-api\">TRN Apex Legends API<\/a><\/p>\n\n\n\n<p>Apex Tracker\u3092API\u3068\u3057\u3066\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u306fAPI\u306e\u30ad\u30fc\u304c\u5fc5\u8981\u3067\u3059\u3002<br>TRN\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u767b\u9332\u3057\u3066\u30ed\u30b0\u30a4\u30f3\u5f8c\u3001\u4e0a\u306eURL\u306e<br>\u300cManage or Create API Keys\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord4.png\" alt=\"\" class=\"wp-image-899\" width=\"553\" height=\"213\"\/><\/figure>\n\n\n\n<p>\u9069\u5f53\u306b\u4f7f\u3044\u305f\u3044\u7406\u7531\u3092\u66f8\u3044\u3066\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u3068\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br>\u305d\u306e\u5f8cAPI\u30ad\u30fc\u3092\u898b\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<br>\u7ba1\u7406\u753b\u9762\u306b\u9077\u79fb\u3057\u3066\u3082\u30ad\u30fc\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord5.png\" alt=\"\" class=\"wp-image-900\" width=\"533\" height=\"169\"\/><\/figure>\n\n\n\n<p>API\u30ad\u30fc\u3092\u53d6\u5f97\u3067\u304d\u305f\u306e\u3067\u3001\u30c8\u30e9\u30c3\u30af\u60c5\u5831\u304c\u53d6\u5f97\u3067\u304d\u308b\u304bcurl\u3067\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<br>\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u304b\u3089\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u6253\u3061\u307e\u3059\u3002<br>\u203bwindows\u3067\u306fcurl\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u5225\u9014\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"has-text-color has-vivid-red-color\">2021\/4\/11\u8ffd\u8a18\uff1a\u3053\u3061\u3089TRN\u306eAPI\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u5909\u308f\u308aURL\u304c\u5909\u308f\u3063\u3066\u304a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<del>curl https:\/\/public-api.tracker.gg\/apex\/v1\/standard\/profile\/5\/[\u30d7\u30ec\u30a4\u30e4\u30fc\u540d] -H &#8220;TRN-API-KEY:[\u53d6\u5f97\u3057\u305fAPI\u30ad\u30fc]&#8221;<\/del>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncurl https:\/\/public-api.tracker.gg\/v2\/apex\/standard\/profile\/&#x5B;platform]\/&#x5B;\u30d7\u30ec\u30a4\u30e4\u30fc\u540d] -H &quot;TRN-API-KEY:&#x5B;\u53d6\u5f97\u3057\u305fAPI\u30ad\u30fc]&quot;\n<\/pre><\/div>\n\n\n<p>[platform]\u2026\u30d7\u30ec\u30a4\u3057\u3066\u3044\u308b\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3092\u5165\u308c\u308b\u3002\u73fe\u5728origin, play station Network, xbox Live\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Origin &#8230; &#8220;origin&#8221;<\/li><li>PlayStationNetwork &#8230; &#8220;psn&#8221;<\/li><li>Xbox Live &#8230; &#8220;xbl&#8221;<\/li><\/ul>\n\n\n\n<p>\u30d7\u30ec\u30a4\u30e4\u30fc\u30c7\u30fc\u30bf\u304c\u8fd4\u3063\u3066\u304d\u305f\u3089\u7121\u4e8b\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3067\u304d\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n  &quot;data&quot;: {\n    &quot;id&quot;: &quot;XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX&quot;,\n    &quot;type&quot;: &quot;player&quot;,\n    &quot;children&quot;: &#x5B;\n      {\n        &quot;id&quot;: &quot;legend_5&quot;,\n        &quot;type&quot;: &quot;&quot;,\n        &quot;metadata&quot;: {\n          &quot;legend_name&quot;: &quot;Bloodhound&quot;,\n          &quot;icon&quot;: &quot;https:\/\/media.contentapi.ea.com\/content\/dam\/apex-legends\/images\/2019\/01\/legends-character-tiles\/apex-grid-tile-legends-bloodhound.png.adapt.crop16x9.png&quot;,\n          &quot;bgimage&quot;: &quot;https:\/\/trackercdn.com\/cdn\/apex.tracker.gg\/legends\/bloodhound-concept-bg-small.jpg&quot;\n        },\n        &quot;stats&quot;: &#x5B;\n          {\n            &quot;metadata&quot;: {\n              &quot;key&quot;: &quot;SeasonWins&quot;,\n              &quot;name&quot;: &quot;Season Wins&quot;,\n              &quot;categoryKey&quot;: &quot;game&quot;,\n              &quot;categoryName&quot;: &quot;Game&quot;,\n              &quot;isReversed&quot;: false\n            },\n            &quot;value&quot;: 11.0,\n            &quot;percentile&quot;: 2.1,\n            &quot;rank&quot;: 3688,\n            &quot;displayValue&quot;: &quot;11&quot;,\n            &quot;displayRank&quot;: &quot;3,688&quot;\n          },\n          {\n            &quot;metadata&quot;: {\n              &quot;key&quot;: &quot;SeasonDamage&quot;,\n              &quot;name&quot;: &quot;Season Damage&quot;,\n              &quot;categoryKey&quot;: &quot;game&quot;,\n              &quot;categoryName&quot;: &quot;Game&quot;,\n              &quot;isReversed&quot;: false\n            },\n            &quot;value&quot;: 27452.0,\n            &quot;percentile&quot;: 3.0,\n            &quot;displayValue&quot;: &quot;27,452&quot;,\n            &quot;displayRank&quot;: &quot;&quot;\n          },\n          {\n            &quot;metadata&quot;: {\n              &quot;key&quot;: &quot;SeasonKills&quot;,\n              &quot;name&quot;: &quot;Season Kills&quot;,\n              &quot;categoryKey&quot;: &quot;game&quot;,\n              &quot;categoryName&quot;: &quot;Game&quot;,\n              &quot;isReversed&quot;: false\n            },\n            &quot;value&quot;: 80.0,\n            &quot;percentile&quot;: 3.8,\n            &quot;rank&quot;: 9927,\n            &quot;displayValue&quot;: &quot;80&quot;,\n            &quot;displayRank&quot;: &quot;9,927&quot;\n          }\n        ]\n      },\n\n...\n...\n}\n<\/pre><\/div>\n\n\n<p>\u3042\u3068\u306f\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092GAS\u304b\u3089\u6253\u3061\u8fbc\u3080\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"has-text-color has-vivid-red-color\">2021\/4\/11\u8ffd\u8a18\uff1aAPI\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u4e0a\u304c\u308a\u3001\u53d6\u5f97\u3067\u304d\u308b\u60c5\u5831\u3082API\u3082\u5897\u3048\u305f\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/tracker.gg\/developers\/docs\/titles\/apex\">https:\/\/tracker.gg\/developers\/docs\/titles\/apex<\/a><\/p>\n\n\n\n<del>\u3061\u306a\u307f\u306b\u3001\u30d7\u30ec\u30a4\u30e4\u30fc\u30c7\u30fc\u30bf\u306fApex Legends\u5185\u3067\u81ea\u5206\u304c\u88c5\u5099\u3057\u3066\u3044\u308b\u30d0\u30ca\u30fc\u306e\u60c5\u5831\u3057\u304b\u53d6\u5f97\u3067\u304d\u306a\u3044\u3067\u3059\u3002\n\u30d0\u30ca\u30fc\u3092\u5909\u3048\u308b\u3068\u53d6\u5f97\u3067\u304d\u308b\u30c7\u30fc\u30bf\u3082\u5909\u308f\u308a\u307e\u3059\u3002<\/del>\n\n\n\n<p>\u60c5\u5831\u304c\u6301\u3063\u3066\u3053\u308c\u306a\u3044\u5834\u5408\u3001TRN\u30a2\u30ab\u30a6\u30f3\u30c8\u3068Apex Legends\u30a2\u30ab\u30a6\u30f3\u30c8\u304c\u7d10\u3065\u3044\u3066\u3044\u306a\u3044\u306e\u3067TRN\u4e0a\u3067\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u8a8d\u8b58\u3055\u305b\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u306fTRN\u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u4e0a\u306e\u300cADD LEGEND\u300d\u3067\u8ffd\u52a0\u3067\u304d\u307e\u3059\u3002<br>Apex Legends\u3092\u5b9f\u969b\u306b\u8d77\u52d5\u3057\u305f\u72b6\u614b\u3067\u3001\u30b2\u30fc\u30e0\u5185\u3067\u30c8\u30e9\u30c3\u30ab\u30fc\u306b\u8ffd\u52a0\u3057\u305f\u3044\u30ad\u30e3\u30e9\u304c\u9078\u629e\u3055\u308c\u305f\u72b6\u614b\u3067\u300cFORCE UPDATE\u300d\u3092\u62bc\u3059\u3068\u53cd\u6620\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 id=\"outline__2_2\" class=\"wp-block-heading\"> \u30c8\u30e9\u30c3\u30ab\u30fc\u60c5\u5831\u53d6\u5f97\u307e\u308f\u308a <\/h3>\n\n\n\n<p>ApexTrack.gs<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nvar key = &quot;&#x5B;\u53d6\u5f97\u3057\u305fAPI\u30ad\u30fc]&quot;;\n\nfunction getApexTrack(member) {\n  var trackUrl = member.trackUrl;\n  \n  var params={\n    headers:{\n      &quot;TRN-API-KEY&quot;:key\n    },\n    method:&quot;get&quot;\n  };\n  \n  var res = UrlFetchApp.fetch(trackUrl,params);\n  \n  \/\/Logger.log(res);\n  return JSON.parse(res);\n}\n\n<\/pre><\/div>\n\n\n<p>\u5f8c\u8ff0\u3057\u307e\u3059\u304c\u3001\u5f15\u6570\u306emember\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u306f\u30d7\u30ec\u30a4\u30e4\u30fc\u306etrackURL\u304c\u542b\u307e\u308c\u3066\u3044\u3066\u3001curl\u3092\u53e9\u304f\u5148\u306eURL\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 id=\"outline__2_3\" class=\"wp-block-heading\">Discord\u307e\u308f\u308a<\/h3>\n\n\n\n<h4 id=\"outline__2_3_1\" class=\"wp-block-heading\">Incoming Webhooks\u306e\u4f5c\u6210 \u203b\u8981\u7ba1\u7406\u8005\u6a29\u9650<\/h4>\n\n\n\n<p>\u30c1\u30e3\u30f3\u30cd\u30eb\u306e\u8a2d\u5b9a\u753b\u9762\u306e\u4e0b\u6bb5\u306b\u300cIncoming Webhooks\u300d\u3068\u3044\u3046\u9805\u76ee\u304c\u3042\u308a\u3001\u305d\u3053\u304b\u3089webhook\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c1\u30e3\u30f3\u30cd\u30eb\u306e\u6a2a\u306e\u8a2d\u5b9a\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord6.png\" alt=\"\" class=\"wp-image-902\" width=\"255\" height=\"75\"\/><\/figure>\n\n\n\n<p>Webhooks\u9805\u76ee\u306e\u300cWebhook\u3092\u4f5c\u6210\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord7.png\" alt=\"\" class=\"wp-image-903\" width=\"511\" height=\"76\"\/><\/figure>\n\n\n\n<p>Webhook\u306e\u8a2d\u5b9a\u753b\u9762\u3067\u3001<br>\u30fbBot\u540d<br>\u30fb\u6295\u7a3f\u3059\u308b\u30c1\u30e3\u30f3\u30cd\u30eb\u540d<br>\u30fb\u30a2\u30a4\u30b3\u30f3\u753b\u50cf<br>\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<br>\u4e0b\u6bb5\u306eWebhookURL\u304cGAS\u3067\u4f7f\u7528\u3059\u308bURL\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord8.png\" alt=\"\" class=\"wp-image-904\" width=\"484\" height=\"626\"\/><\/figure>\n\n\n\n<h4 id=\"outline__2_3_2\" class=\"wp-block-heading\">\u901a\u5e38\u306e\u30c6\u30ad\u30b9\u30c8\u306b\u3088\u308b\u6295\u7a3f<\/h4>\n\n\n\n<p>postDiscord.gs<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nfunction testPost() {\n  var text = &quot;text&quot;;\n  postDiscord(text);\n}\n\nfunction postDiscord(text,url) {\n  \n  \/\/Discord\u306eIncoming Webhook\u3067\u53d6\u5f97\u3057\u305fURL\n  var url=&quot;https:\/\/discordapp.com\/api\/webhooks\/9999999999999999\/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX&quot;;\n  \/\/URL\u306e\u4e00\u756a\u53f3\u306e\u6587\u5b57\u5217\n  var token=&quot;XXXXXXXXXXXXXXXXXXXXXXXXXXXXX&quot;;\n  var channel=&quot;#general&quot;;\n  var username=&quot;ApexTrackerBOT&quot;;\n  var parse = &quot;full&quot;;\n  var method= &quot;post&quot;;\n  \n  \n  var jsonData={\n    &quot;token&quot;:token,\n    &quot;channel&quot;:channel,\n    &quot;username&quot;:username,\n    &quot;content&quot;:text,\n    &quot;parse&quot;:parse,\n  }\n  \n  var options={\n    &quot;method&quot;:method,\n    &quot;headers&quot;:{&quot;Content-type&quot;:&quot;application\/json&quot;},\n    &quot;payload&quot;:JSON.stringify(jsonData),\n    &quot;muteHttpExceptions&quot;:true\n  };\n  \n  UrlFetchApp.fetch(url,options);\n}\n<\/pre><\/div>\n\n\n<p>testPost()\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u30c6\u30b9\u30c8\u6295\u7a3f\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord9.png\" alt=\"\" class=\"wp-image-905\" width=\"567\" height=\"168\"\/><\/figure>\n\n\n\n<h4 id=\"outline__2_3_3\" class=\"wp-block-heading\">Embed\u3092\u5229\u7528\u3057\u305f\u6295\u7a3f<\/h4>\n\n\n\n<p>Embed\u3068\u306f\u3001\u540d\u524d\u3068\u5b9f\u969b\u306e\u5024\u3068\u3044\u3046\u30da\u30a2\u3092\u826f\u3044\u611f\u3058\u306b\u51fa\u3057\u3066\u304f\u308c\u308b\u6a5f\u80fd\u3067\u3059\u3002<br>Discord\u3060\u3051\u3067\u306a\u304f\u3001Slack\u306b\u3082\u540c\u3058\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>postDiscordEmbed.gs<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nfunction testPostEmbed() {\n  \n  var embed = {};\n  \n  embed.fields = &#x5B;];\n  embed.fields.push({\n    name: 'Test',\n    value: '-------------------'\n  });\n  \n  postDiscordEmbed(&quot;&quot;,embed);\n}\n\nfunction postDiscordEmbed(msg,embed) {\n  \n  \/\/Discord\u306eIncoming Webhook\u3067\u53d6\u5f97\u3057\u305fURL\n  var url=&quot;https:\/\/discordapp.com\/api\/webhooks\/9999999999999999\/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX&quot;;\n  \/\/URL\u306e\u4e00\u756a\u53f3\u306e\u6587\u5b57\u5217\n  var token=&quot;XXXXXXXXXXXXXXXXXXXXXXXXXXXXX&quot;;\n  var channel=&quot;#bot&quot;;\n  var username=&quot;ApexTrackerBOT&quot;;\n  var parse = &quot;full&quot;;\n  var method= &quot;post&quot;;\n  \n  var jsonData={\n    &quot;token&quot;:token,\n    &quot;channel&quot;:channel,\n    &quot;username&quot;:username,\n    &quot;content&quot;:msg,\n    &quot;embeds&quot;:, \n    &quot;parse&quot;:parse,\n  }\n  \n  var options={\n    &quot;method&quot;:method,\n    &quot;headers&quot;:{\n      &quot;Content-type&quot;:&quot;application\/x-www-form-urlencoded&quot;,\n      &quot;User-Agent&quot;:&quot;DiscordBot&quot;\n    },\n    &quot;payload&quot;:JSON.stringify(jsonData),\n    &quot;muteHttpExceptions&quot;:true\n  };\n  UrlFetchApp.fetch(url,options);\n}\n<\/pre><\/div>\n\n\n<p> testPostEmbed()\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u30c6\u30b9\u30c8\u6295\u7a3f\u3055\u308c\u307e\u3059\u3002 <\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord10.png\" alt=\"\" class=\"wp-image-906\" width=\"550\" height=\"214\"\/><figcaption>\u5225\u306e\u30c1\u30e3\u30f3\u30cd\u30eb\u7528\u306b\u65b0\u305f\u306b\u4f5c\u6210\u3057\u305fBot\u3067\u6295\u7a3f\u3057\u305f\u305f\u3081\u3001\u753b\u50cf\u304c\u307e\u3060\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/figcaption><\/figure>\n\n\n\n<h3 id=\"outline__2_4\" class=\"wp-block-heading\"> \u4e00\u3064\u306eApp\u3068\u3057\u3066\u307e\u3068\u3081\u308b <\/h3>\n\n\n\n<h4 id=\"outline__2_4_1\" class=\"wp-block-heading\">\u30c6\u30ad\u30b9\u30c8\u5f62\u5f0f\u3067\u6295\u7a3f\u3059\u308b\uff08\u975eEmbed\uff09<\/h4>\n\n\n\n<p>main.gs<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nvar members = {\n  player1: {\n    name : 'player1',\n    imgUrl : '&#x5B;\u30e1\u30f3\u30d0\u30fc\u306e\u30a2\u30a4\u30b3\u30f3\u3068\u3057\u3066\u4f7f\u3044\u305f\u3044\u753b\u50cfURL]',\n    trackUrl : &quot; https:\/\/public-api.tracker.gg\/v2\/apex\/standard\/profile\/origin\/&#x5B;\u30d7\u30ec\u30a4\u30e4\u30fc\u540d]&quot;\n  },\n  player2: {\n    name : 'player2',\n    imgUrl : '&#x5B;\u30e1\u30f3\u30d0\u30fc\u306e\u30a2\u30a4\u30b3\u30f3\u3068\u3057\u3066\u4f7f\u3044\u305f\u3044\u753b\u50cfURL]',\n    trackUrl : &quot; https:\/\/public-api.tracker.gg\/v2\/apex\/standard\/profile\/origin\/&#x5B;\u30d7\u30ec\u30a4\u30e4\u30fc\u540d]&quot;\n  }\n};\n\nfunction memberData_text() {\n  for(var key in members) {\n    \n    var legends = getCharactorsData(getApexTrack(members&#x5B;key]));\n    \n    for (var i=0; i&lt;legends.length; i++) {\n      var text = makeText(members&#x5B;key],legends&#x5B;i]);\n      \n      postDiscord(text);\n      \/\/\u30ad\u30e3\u30e9\u5206\u9023\u7d9a\u6295\u7a3f\u3059\u308b\u305f\u3081\u30010.5\u79d2\u9045\u5ef6\u3055\u305b\u3066\u6295\u7a3f\u304c\u53cd\u6620\u3055\u308c\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u308b\n      Utilities.sleep(500);\n    }\n  }\n}\n\nfunction makeText(member,legend) {\n  \n  var text = &#x5B;]\n  \n  text.push(&quot;**\u3010Apex Legends DATA\u3011&quot; + member.name + &quot;**&quot;);\n  text.push(&quot;**Legend Name:&quot; + legend&#x5B;'legendName'] + &quot;**&quot;);\n  delete legend&#x5B;'legendName'];\n  \n  text.push(legend&#x5B;'bgimage']);\n  delete legend&#x5B;'bgimage'];\n  \n  text.push(&quot;==========================================&quot;);\n  \n  for(var key in legend) {\n    text.push(key + &quot; : &quot; + legend&#x5B;key]);\n  }\n  \n  text.push(&quot;==========================================&quot;);\n  \n  return text.join(&quot;\\n&quot;);\n}\n\nfunction getCharactorsData(jsonData) {\n  \n  var charactors = &#x5B;];\n  \n  for each(var charactor in jsonData&#x5B;'data']&#x5B;'children']) {\n    \n    \/\/\u521d\u671f\u5316\u3068\u3068\u3082\u306b\u30ec\u30b8\u30a7\u30f3\u30c9\u540d\u3092\u8a2d\u5b9a\n    var legend = {legendName: charactor&#x5B;'metadata']&#x5B;'legend_name']};\n    \/\/\u30a2\u30a4\u30b3\u30f3\u3092\u8a2d\u5b9a\n    legend&#x5B;'bgimage'] = charactor&#x5B;'metadata']&#x5B;'bgimage'].toString();\n    \n    \/\/\u30b2\u30fc\u30e0\u4e0a\u306e\u30d0\u30ca\u30fc\u3067\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u9805\u76ee\u3092\u8a2d\u5b9a\n    for(var i=0; i&lt;charactor&#x5B;'stats'].length; i++) { \n      legend&#x5B;charactor&#x5B;'stats']&#x5B;i]&#x5B;'metadata']&#x5B;'key'].toString()] = charactor&#x5B;'stats']&#x5B;i]&#x5B;'value'].toString();\n    } \n    charactors.push(legend);\n  }\n  \/\/Logger.log(charactors);\n  return charactors;\n}\n<\/pre><\/div>\n\n\n<p>\u6d41\u308c\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u30c8\u30ea\u30ac\u30fc\u304b\u3089\u30e1\u30a4\u30f3\u306e\u95a2\u6570\u304c\u5b9f\u884c\u3055\u308c\u308b\uff08memberData_text()\uff09<\/li><li>members\u306b\u683c\u7d0d\u3055\u308c\u305f\u30d7\u30ec\u30a4\u30e4\u30fc\u5206\u306e\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u30c7\u30fc\u30bf\u30ea\u30b9\u30c8\u3092\u53d6\u5f97\u3059\u308b\u3002<br>\uff08getCharactorsData(jsonData)\uff09<\/li><li>\u53d6\u5f97\u3067\u304d\u305f\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u30c7\u30fc\u30bf\u5206\u3001\u6295\u7a3f\u5185\u5bb9\u3092\u7d44\u307f\u7acb\u3066\u3066Discord\u306b\u6295\u7a3f\u3059\u308b\u3002\uff08makeText(member,legend)\uff09<\/li><\/ol>\n\n\n\n<h4 id=\"outline__2_4_2\" class=\"wp-block-heading\"> Embed\u5f62\u5f0f\u3067\u6295\u7a3f\u3059\u308b <\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nvar members = {\n  player1: {\n    name : 'player1',\n    imgUrl : '&#x5B;\u30e1\u30f3\u30d0\u30fc\u306e\u30a2\u30a4\u30b3\u30f3\u3068\u3057\u3066\u4f7f\u3044\u305f\u3044\u753b\u50cfURL]',\n    trackUrl : &quot; https:\/\/public-api.tracker.gg\/v2\/apex\/standard\/profile\/origin\/&#x5B;\u30d7\u30ec\u30a4\u30e4\u30fc\u540d]&quot;\n  },\n  player2: {\n    name : 'player2',\n    imgUrl : '&#x5B;\u30e1\u30f3\u30d0\u30fc\u306e\u30a2\u30a4\u30b3\u30f3\u3068\u3057\u3066\u4f7f\u3044\u305f\u3044\u753b\u50cfURL]',\n    trackUrl : &quot; https:\/\/public-api.tracker.gg\/v2\/apex\/standard\/profile\/origin\/&#x5B;\u30d7\u30ec\u30a4\u30e4\u30fc\u540d]&quot;\n  }\n};\n\nfunction memberData_embed() {\n  for(var key in members) {\n    \n    var legends = getCharactorsData(getApexTrack(members&#x5B;key]));\n    \n    var embed = makeEmbed(members&#x5B;key], legends);\n    \n    postDiscordEmbed(&quot;&quot;,embed);\n  }\n}\n\nfunction makeEmbed(member, legend) {\n  \n  var embed = {};\n  \n  embed.title = &quot;Apex TRN&quot;;\n  embed.description = &quot;Apex Legends Tracker&quot;;\n  embed.url = &quot;https:\/\/thetrackernetwork.com\/&quot;;\n  embed.color = 3329330;\n  embed.author = {name: member.name, icon_url: member.imgUrl};\n  embed.fields = &#x5B;];\n  \n  for(var i=0; i&lt;legend.length; i++) {\n    \n    embed.fields.push({\n      name: &quot;__&quot; + legend&#x5B;i]&#x5B;'legendName'] + &quot;__&quot;,\n      value: &quot;===============================&quot;\n    });\n    \n    delete legend&#x5B;i]&#x5B;'legendName'];\n    delete legend&#x5B;i]&#x5B;'bgimage'];\n    \n    for(var key in legend&#x5B;i]) {\n      embed.fields.push({\n        name: key,\n        value: legend&#x5B;i]&#x5B;key],\n        inline: true\n      });\n    }\n  }\n  return embed;\n}\n\nfunction getCharactorsData(jsonData) {\n  \n  var charactors = &#x5B;];\n  \n  for each(var charactor in jsonData&#x5B;'data']&#x5B;'children']) {\n    \n    \/\/\u521d\u671f\u5316\u3068\u3068\u3082\u306b\u30ec\u30b8\u30a7\u30f3\u30c9\u540d\u3092\u8a2d\u5b9a\n    var legend = {legendName: charactor&#x5B;'metadata']&#x5B;'legend_name']};\n    \/\/\u30a2\u30a4\u30b3\u30f3\u3092\u8a2d\u5b9a\n    legend&#x5B;'bgimage'] = charactor&#x5B;'metadata']&#x5B;'bgimage'].toString();\n    \n    \/\/\u30b2\u30fc\u30e0\u4e0a\u306e\u30d0\u30ca\u30fc\u3067\u8a2d\u5b9a\u3057\u3066\u3044\u308b\u9805\u76ee\u3092\u8a2d\u5b9a\n    for(var i=0; i&lt;charactor&#x5B;'stats'].length; i++) { \n      legend&#x5B;charactor&#x5B;'stats']&#x5B;i]&#x5B;'metadata']&#x5B;'key'].toString()] = charactor&#x5B;'stats']&#x5B;i]&#x5B;'value'].toString();\n    } \n    charactors.push(legend);\n  }\n  \/\/Logger.log(charactors);\n  return charactors;\n}\n<\/pre><\/div>\n\n\n<p>\u6d41\u308c\u306f\u30c6\u30ad\u30b9\u30c8\u5f62\u5f0f\u306e\u6642\u3068\u540c\u3058\u6d41\u308c\u3067\u3059\u304c\u3001Embed\u5f62\u5f0f\u306e\u5834\u5408\u306f\u30ad\u30e3\u30e9\u3054\u3068\u306b\u6295\u7a3f\u3059\u308b\u5fc5\u8981\u306f\u306a\u304f\u3001\u307e\u3068\u3081\u3066Embed\u7528\u306e\u914d\u5217\u306b\u683c\u7d0d\u3059\u308c\u3070OK\u3067\u3059\u3002<br>\u3061\u306a\u307f\u306b\u3001\u753b\u50cfURL\u3082\u683c\u7d0d\u3067\u304d\u307e\u3059\u304c\u30a4\u30e1\u30fc\u30b8\u306fDiscord\u306b\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u30c6\u30b9\u30c8\u3057\u3066\u3044\u3066\u6c17\u4ed8\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u753b\u50cfURL\u3092\u6295\u7a3f\u3057\u305f\u6642\u306e\u52d5\u4f5c\u304cSlack\u3068Discord\u3067\u9055\u3063\u3066\u3044\u3066\u3001<br>\u30fbSlack\u306e\u5834\u5408\u306fURL\u306e\u3059\u3050\u4e0b\u306b\u753b\u50cf\u304c\u5dee\u3057\u8fbc\u307e\u308c\u3066\u8868\u793a\u3055\u308c\u308b<br>\u30fbDiscord\u306e\u5834\u5408\u306f\u6295\u7a3f\u6587\u306e\u4e0b\u306b\u307e\u3068\u3081\u3066\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u308b<br>\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<h3 id=\"outline__2_5\" class=\"wp-block-heading\">\u30c8\u30ea\u30ac\u30fc<\/h3>\n\n\n\n<p>\u6bce\u65e5Bot\u304c\u30c1\u30e3\u30f3\u30cd\u30eb\u306b\u6295\u7a3f\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/05\/postDiscord11.png\" alt=\"\" class=\"wp-image-907\" width=\"536\" height=\"572\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Slack\u3068\u540c\u3058Electron\u3067\u51fa\u6765\u3066\u3044\u308bDiscord\u306fSlack\u306ebot\u306e\u4f5c\u308a\u65b9\u3068\u89aa\u548c\u6027\u304c\u9ad8\u304f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":881,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[125],"tags":[204,207,208,206,199,198,205],"class_list":["post-894","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bot","tag-apex-legends","tag-api","tag-curl","tag-discord","tag-gas","tag-google-apps-script","tag-trn"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=894"}],"version-history":[{"count":6,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/894\/revisions"}],"predecessor-version":[{"id":1237,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/894\/revisions\/1237"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/media\/881"}],"wp:attachment":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}