ndarville / starter-node-bot

Slackbot by N. Darville. Made with Beep Boop and Botkit.
MIT License
0 stars 0 forks source link

Convert conjugator output from attachment to multiline message #4

Closed ndarville closed 8 years ago

ndarville commented 8 years ago

Looks better like this:

Multiline message example

ndarville commented 8 years ago

Current

var dict = nlp.verb(message.match[1]).conjugate();

bot.reply(message, {
    "attachments": [{
        "fallback" : "Conjugation of _\"to " + message.match[1] + "\"_",
        "pretext"  : "`" + message.match[1] + "`",
        "mrkdwn_in": ["fallback", "pretext"],
        "color"    : config.color,
        "fields"   : Object.keys(dict).map(function(key) {
            return {
                "title": capitalizeFirstLetter(key).replace("_", " "),
                "value": dict[key],
                "short": false
            };
        })
    }]
});

Future

var dict = nlp.verb(message.match[1]).conjugate(),
    output = "";

// Slack trims the trailing newline
Object.keys(dict).map(function(key) {
    return output += "*" + capitalizeFirstLetter(key).replace("_", " ") + ":*" + \
    dict[key] + "\n";
]);

bot.reply(message, output);
ndarville commented 8 years ago

How come you can’t add photos when the issue is closed?

dev1

dev2

dev3