JavaScript is required to use Bungie.net

Group Avatar

BungieNetPlatform

「Updates, discussions, and documentation of the BungieNetPlatform API.」

オリジナルの投稿元:BungieNetPlatform
2/22/2017 12:31:10 AM
1

Slightly off-topic Slack bot

Our clan uses Slack for keeping in touch. I created a Slack bot that utilizes the Slack real-time API to welcome new Destiny guardians to the clan. The bot is written in node.js and deployed in AWS utlizing Elastik Beanstalk. The welcome message is stored in a flat file that is read at run time. I had hoped I could change the contents of the flat file without deploying each time a change was requested. Unfortunately, I was wrong but am too lazy to bring the message into the main code as a variable :-) The Slack token and channel are stored in process.env as part of the Elastik Beanstalk configuration. So Destiny related but not really :-) Jason [quote] var fs = require('fs'); var token = process.env.token; var RtmClient = require('@slack/client').RtmClient; var RTM_EVENTS = require('@slack/client').RTM_EVENTS; var rtm = new RtmClient(token); rtm.start(); rtm.on(RTM_EVENTS.TEAM_JOIN, function handleRtmTeamJoin(team) { var channel = process.env.channel; var welcome = fs.readFileSync('welcome.msg', 'utf8'); rtm.sendMessage('<@' + team.user.id + '> welcome to Iron Orange! ' + welcome, channel); console.log('User added:', team); }); [/quote]

投稿言語:

 

マナーを守りましょう。投稿する前に、Bungie の行為規範を確認してください。 キャンセル 編集 ファイアチームを作る 投稿

トピック全体を表示
このコンテンツはご覧いただけません。
;
preload icon
preload icon
preload icon