我有一台Kik机器人,我在我的电脑上托管。我使用以下代码设置配置:
let request = require('request')
request.post('https://api.kik.com/v1/config',
{
"auth":{
"user":"bhs************",
"pass":"*******-*****-*****-****"
},
"headers":{
"User-Agent":"request"
},
"form":{
"webhook":"https://(my public ip):8080",
"features":{
"manuallySendReadReceipts":false,
"receiveReadReceipts":false,
"receiveDeliveryReceipts":false,
"receiveIsTyping":false
}
}
});
这是我实际机器人的代码:
'use strict';
let util = require('util');
let https = require('https');
let Bot = require('@kikinteractive/kik');
// Configure the bot API endpoint, details for your bot
let bot = new Bot({
username: 'bhs************',
apiKey: '*******-*****-*****-****',
baseUrl: 'https://(my public ip):8080'
});
bot.updateBotConfiguration();
bot.onTextMessage((message) => {
console.log("New Message")
message.reply(message.body);
});
// Set up your server and start listening
let server = https
.createServer(bot.incoming())
.listen(8080);
console.log("Server Running on port 8080")
我在路由器上设置了端口转发,使用内部和外部端口8080重定向到我的计算机。我还将协议设置为TCP和UDP。如果是这样的设置,这是一张照片: