我正在使用twit npm包来阅读直接消息
var stream = T.stream('user', { stringify_friend_ids: true })
stream.on('direct_message', function (directMsg) {
console.log(directMsg)
}
我想回复收到的directMsg
,是否有任何方法调用twit可用于实现或推荐达到相同的任何其他nodejs包。
答案 0 :(得分:1)
无法提供确切的代码解决方案,但方法是实现以下步骤
USER_ID
对象directMsg
属性
T.post(path, [params], callback)
通过USER_ID
所以代码看起来像这样
T.post("direct_messages/new", {
user_id: USER_ID, // USER_ID is parameter from directMsg object
text: 'YOUR_REPLY'
});
希望它会对你有所帮助。
答案 1 :(得分:0)
即使我遇到它,这是你必须做的。
收听user
的{{1}}信息流并检索direct_message
和sender.screen_name
并验证它不相等+您需要{@ 1}},如上面@RashadIbrahimov所述。
recipient.screen_name
并打电话给它
sender.id