を聞いていない。そして、https://github.com/howdyai/botkit-starter-slackBotkitスラックボットは、私たちはここからレポで自分のガイドラインとクローニングを、以下、紺碧のbotkitボットを開催しました(紺碧上でホストされている)新しいJSファイル
、私は新しいJSファイルを追加してみました以下のように見えるスキルフォルダへ:
var Botkit = require('botkit');
var controller = Botkit.slackbot({});
controller.hears(['help'], 'direct_message,direct_mention,mention', (bot, message) => {
bot.reply(message, {
text: `You can ask me things like:
"Today's agenda"
"Create event"`
});
});
controller.hears(['create event', 'new event'], 'direct_message,direct_mention,mention', (bot, message) => {
let subject,
start,
duration,
description,
location,
invitees,
whatid,
whoid;
let askSubject = (response, convo) => {
convo.ask("What is the subject of the event?", (response, convo) => {
subject = response.text;
askStart(response, convo);
convo.next();
});
}
let askStart = (response, convo) => {
convo.ask("When would you like this event to start?", (response, convo) => {
start = response.text;
askDuration(response, convo);
convo.next();
});
}
let askDuration = (response, convo) => {
convo.ask("How long will this event be?", (response, convo) => {
duration = response.text;
askDescription(response, convo);
convo.next();
});
}
let askDescription = (response, convo) => {
convo.ask("Enter a description if you'd like.", (response, convo) => {
description = response.text;
askLocation(response, convo);
convo.next();
});
}
let askLocation = (response, convo) => {
convo.ask("Enter a locatoin if you'd like.", (response, convo) => {
location = response.text;
askInvitees(response, convo);
convo.next();
});
}
let askInvitees = (response, convo) => {
convo.ask("Enter a comma seperated list of invitees if you'd like.", (response, convo) => {
invitees = response.text;
askWhatId(response, convo);
convo.next();
});
}
let askWhatId = (response, convo) => {
convo.ask("Add anything to the Related To field?", (response, convo) => {
whatid = response.text;
askWhoId(response, convo);
convo.next();
});
}
let askWhoId = (response, convo) => {
convo.ask("Add anyone to the Name field?", (response, convo) => {
whoid = response.text;
/*salesforce.createContact({firstName: firstName, lastName: lastName, title: title, phone: phone})
.then(contact => {
bot.reply(message, {
text: "I created the contact:",
attachments: formatter.formatContact(contact)
});
convo.next();
})
.catch(error => {
bot.reply(message, error);
convo.next();
});*/
});
}
bot.reply(message, "OK, I can help you with that!");
bot.startConversation(message, askSubject);
});
ボットは正しくごスラックチャネルと通信し、私たちは基本的に入力することができ、すでにコマンドを含め、応答を取得します。しかし、私が作成したこの新しいスクリプトにアクセスするために「新しいイベント」と入力すると、何も起こりません。
ぼんやりしたボットがそれらを選ぶように、私は空のボットキットボットをローカルにホストするときに、新しいスキルスクリプトを追加する方法について非常に良い文書を見つけることができません...私は、 var controller line)をmodule.exports = function(controller)に入れても、まだ応答がありません。
スキルフォルダ内の新しいjsファイルでカスタム会話をどのようにして、私の既に夢中になっているスラックボットが実際にそれを聞いてくれるかについてのアドバイスはありますか?