- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在使用 Twit Node.js API。我想做的是回复与某个关键字匹配的推文。我希望我的回复推文显示在下面的其他推文中。就像您通过应用程序或网站回复一样。
我的代码在这里:
var reply = function(tweet) {
var res = {
status: 'This is a tweet',
in_reply_to_status_id: tweet.id_str
};
twitter.post('statuses/update', res,
function(err, data, response) {
console.log(data);
}
);
}
状态已正确写入回复 JSON,但 in_reply_to_status_id 仍为空。该推文已发布到机器人帐户,但并未回复应回复的推文。
为什么不起作用?
是的,我尝试写入 in_reply_to_status_id_str 并尝试将 tweet.id_str 设为字符串。
有人知道我错过了什么吗?
谢谢!
我的响应 JSON 在这里:
{ created_at: 'Wed Jun 21 07:44:22 +0000 2017',
id: 877431986071142400,
id_str: '877431986071142400',
text: 'This is a tweet',
truncated: false,
entities: { hashtags: [], symbols: [], user_mentions: [], urls: [] },
source: '<a href="https://example.com" rel="nofollow">Spatinator</a>',
in_reply_to_status_id: null,
in_reply_to_status_id_str: null,
in_reply_to_user_id: null,
in_reply_to_user_id_str: null,
in_reply_to_screen_name: null,
如果您需要更多响应 JSON,请告诉我。
最佳答案
解决方案是在响应 json 的状态中包含对 tweet.user.screen_name 的提及。像这样它的工作原理:
var reply = function(tweet) {
var res = {
status: 'This is a tweet @' + tweet.user.screen_name,
in_reply_to_status_id: '' + tweet.id_str
};
twitter.post('statuses/update', res,
function(err, data, response) {
console.log(data);
}
);
}
关于javascript - 使用 twit 和 Node.js 回复推文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44669859/
我目前正在使用 nodejs 和 Twit API Client 编写一个小型 Twitter Bot . 当我回复推文时,我使用以下代码: T.post('statuses/update', { s
我正在自学 javascript 和 Node。现在我想做的是制作一个 Twitter 机器人,它可以从列表中随机发送句子。到目前为止,我已经发布了 0 到 100 之间的随机数的代码: consol
我正在点击链接Twit NPM 访问 Twitter 流。 我执行以下操作 var T = new Twit({ consumer_key: 'key', consum
我想从某个网址下载一个 img 并将其直接上传到 Twitter,而不先将其保存到文件中。 到目前为止,我已经测试了网上找到的所有方法,但没有成功。我总是收到“媒体类型无法识别”错误。 http.
我在 Windows 上使用 twitter4j-3.0.5。 当新状态到达 StatusListener 时。 onStatus()方法,我想打印出它的 URL,但我找不到任何合适的方法。状态。 g
我正在使用 twit .更新状态(无媒体)工作正常,但 update with media不工作。 这是我的代码(与 express 一起使用): //client side
我正在使用 node.js Twit模块;用户通过身份验证后,如何获取该用户的推文?该文档没有说明如何操作。 以下返回 null: var Twit=require('twit'); var T =
我对这一切都是全新的,所以如果这不是发帖的正确位置,我深表歉意,但我正在使用 Twit 开发 NodeJS 应用程序。 这是我一开始声明变量的内容: var Twit = require('twit'
我正在使用 Twit Node.js API。我想做的是回复与某个关键字匹配的推文。我希望我的回复推文显示在下面的其他推文中。就像您通过应用程序或网站回复一样。 我的代码在这里: var reply
不确定如何输入 in_reply_to_status_id。 它的推文很好,只是没有回复其中提到的推文。 in_reply_to_status_id 是 Twit 访问的 Twitter API 的一
问题 所以我尝试创建一个 Twitter 机器人,一切都很顺利,直到我尝试自动回复关注我的用户。我正在学习并观看本教程 Coding Train Twitter Bot(LINK)但我似乎明白了 er
是否可以在页面上显示 Facebook feed、twitter twits 和 LinkedIn 连接,而无需输入 Facebook、twitter 和 ln 帐户的用户 key ? 我只想输入 F
我有这个代码使用 Twit var Twit = require('twit') var T = new Twit({ consumer_key: 'my creds' , con
这是不起作用的代码: var Twit = require('twit'); //Using Twit var config = require('./config'); //Loading
我正在使用 Node 和 npm Twit 模块将推文发布到 Twitter。它正在工作......有点。 我能够成功发布一条推文,没有任何问题。但是,当我尝试一起发布一串推文(如 Twitter 上
我想刷新 Twit 流。 我有一个使用 npm 模块 Twit 制作的 Twitter 流(您可以在这里找到它:https://github.com/ttezel/twit)。 这是我的代码: Res
目前推文机器人是; var fs = require('fs'), path = require('path'), Twit = require('twit'), config
所以我正在使用 Twit https://github.com/ttezel/twit对于 Node 我想从 twitter 1.1 api 获取 OEMBED 代码,但它似乎不起作用。 twit.g
我正在为 twitter api 使用 twit node.js 模块,我试图通过使用他们的 id 来获取用户列表的状态流,但是当我运行脚本时出现以下错误 Error: Bad Twitter str
使用 Twitter API,我试图代表 Twitter 用户发布推文。 我正在使用 Node 和 passport-twitter和 twit模块。 一些资源: 我学习了这个视频教程 NodeJS
我是一名优秀的程序员,十分优秀!