originally posted in:BungieNetPlatform
View Entire Topic
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]
English
#Offtopic
-
Whats the problem exactly? I do a fair bit with node so I might be able to help.