• Register

We're an indie team developing a series of dark-themed mystery games and light novels, set in a world called Kikai.

Post tutorial Report RSS Kai & Kira on Slack!

After making the kids respond to simple sentences in the previous update, I have come up with the idea of bringing the kids to Slack so everyone in the team could talk to them!

Posted by on - Intermediate Server Side Coding

Introduction

After making the kids respond to simple sentences in the previous update, I have come up with the idea of bringing the kids to Slack so everyone in the team could talk to them!


Why?

1. It's fun as hell, to "talk" to the kids through a chat app like that
2. Everyone in the team can have instant access to the kids, which help testing and suggesting processes a lot
3. We can examine, test the kids almost everywhere, like using the Slack App on our mobile phones in the train, etc
4. Updating the kids and running the node server is very straightforward

How?

Slack is amazing! They support building bots greatly so the whole process is pretty straightforward.
First, I made a few tweaks so I could run our Language System program through the command line.


With that, we can now run the program in node environment, with the child_process.execFile function:

if (fs.existsSync(path_to_program)) {
  execFile(path_to_program, [to, message], (err, stdout, stderr) => {
    if (err) {
      console.error(err);
    } else {
      // send stdout as the reply
    }
  });
} else {
  // hmmm
}

Now adding code to use the Slack's APIs then we're solid.

References
1. Automating a C++ program from a Node.js web app
2. Slack's bot users Introduction
3. Slack Developer Kit for Node.js
4. Slack Building Bots Guide
5. A Super helpful tip. Also, do not forget to add your bots to the channels they need to post messages to first!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: