我正在尝试构建 Skype 机器人。
我遵循了给出的文档,skype-sdk
但未能使用它创建它。无法得到机器人的回复。
const fs = require('fs');
const restify = require('restify');
const skype = require('skype-sdk');
const botService = new skype.BotService({
messaging: {
botId: 'xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx',
serverUrl : "https://example.net",
requestTimeout : 15000,
appId: 'xxxxxxxx-xxx-xxx-xxx-xxxxxxxxxxxx',
appSecret: 'xxxxxxxxxxxxxxxxxxxxxxxx'
}
});
botService.on('contactAdded', (bot, data) => {
console.log("bot replay");
bot.reply('Hello ${data.fromDisplayName}!', true);
});
botService.on('personalMessage', (bot, data) => {
console.log("person replay");
bot.reply('Hey ${data.from}. Thank you for your message: "${data.content}".', true);
});
const server = restify.createServer();
server.use(skype.ensureHttps(true));
server.use(skype.verifySkypeCert({}));
server.post('/skbot', skype.messagingHandler(botService));
const port = process.env.PORT || 8080;
server.listen(port);
console.log('Listening for incoming requests on port ' + port);
谢谢