【发布时间】:2020-10-11 10:59:50
【问题描述】:
我正在尝试创建一个带有新推文通知的不和谐机器人。
我为此使用T.stream('statuses/filter', { follow : ['798934987978510337'] });,但它也显示提及。
我可以只从有 twit 的用户那里获取推文吗?
【问题讨论】:
-
语法和大写改写
标签: javascript node.js npm twitter
我正在尝试创建一个带有新推文通知的不和谐机器人。
我为此使用T.stream('statuses/filter', { follow : ['798934987978510337'] });,但它也显示提及。
我可以只从有 twit 的用户那里获取推文吗?
【问题讨论】:
标签: javascript node.js npm twitter
不,statuses/filter 流媒体 API 也包含转推。如果您不想将转发传递给 Discord,则需要过滤掉您自己代码中的转发。
【讨论】:
以下代码对我有用。参考https://twittercommunity.com/t/only-receive-latest-tweet-from-specific-user-twit-npm/151478
var twitParams =
{
exclude_replies: false,
count: 1,
screen_name: "your screen name excluding @"
}
T.get("statuses/user_timeline", twitParams, function(err, data, response) {
console.log(data);
});
【讨论】: