2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

七夕なのでbotに願いごとしてみた

Posted at

去年はシェルスクリプトで願いごとしたので
今年はbotで願いごとしてみた

bot.js
if (!process.env.token) {
    console.log('Error: Specify token in environment');
    process.exit(1);
}

var Botkit = require('botkit');
let fs = require('fs')

var controller = Botkit.slackbot({
    debug: false
});

var bot = controller.spawn({
    token: process.env.token
}).startRTM();


controller.hears(['短冊 (.*)'],['direct_message', 'direct_mention', 'mention'], function(bot, message) {

    let tanzaku = "┏┷┓";

    for(let s of message.match[1].split('')){
      tanzaku += `\n┃${s}┃`
    }
    tanzaku += "\n┗━┛"

    bot.reply(message, '```\n' + tanzaku + '\n```')

});
スクリーンショット 2017-07-07 17.05.11.png

コードはgithubにもあげています

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?