javascript - 如何从值中获取“captureDate”并将其作为消息发送
问题描述
所以我在我的不和谐机器人中添加了一个功能来收集用户最近的游戏剪辑,目前我能够在我的控制台日志中收集所有信息,但很难理解如何在消息中发送它。我对这些东西很陌生。
这是我现在的代码片段:
const userXuid = await XboxLiveAPI.getPlayerXUID(gamertag, authInfo).catch(err => message.reply('That gamertag could not be found. Make sure spaces are replaced with \'_\''));
const scores = await XboxLiveAPI.getPlayerScreenshotsFromMediaHub(userXuid, authInfo, num);
console.log(scores);
这就是返回到控制台的内容:
{
continuationToken: 'YWJjZGVfdnd4eXoxMDA1',
values: [
{
captureDate: '2016-09-13T19:11:11Z',
contentId: 'e61118b6-c940-4hc9-a32a-49dd53ab4192',
contentLocators: [Array],
CreationType: 'Edited',
localId: '501bf44b-c1b2-4519-b78e-a1f88097f8d1',
ownerXuid: 25332749247888726,
resolutionHeight: 720,
resolutionWidth: 1280,
sandboxId: 'RETAIL',
sharedTo: [],
titleId: 1129121809,
titleName: 'OF: Dragon Rising',
dateUploaded: '2016-09-13T19:12:34.6226406Z',
uploadLanguage: 'en-GB',
uploadRegion: 'GB',
uploadTitleId: 201477059,
uploadDeviceType: 'XboxOne',
commentCount: 0,
likeCount: 0,
shareCount: 0,
viewCount: 2,
contentState: 'Published',
enforcementState: 'None',
safetyThreshold: 'None',
sessions: [],
tournaments: []
}
]
}
结论
那么,例如,我将如何让 captureDate 发送:
message.channel.send(???)
任何帮助将不胜感激,干杯!
解决方案
如果您只是在谈论访问 captureDate
,您将使用scores.values[0].captureDate
.
推荐阅读
- mysql - 错误代码 1452,难以将数据加载到具有外键的表中
- javascript - 在数组中查找子集组合
- logging - 网站不时停机:如何从 HAProxy 日志中获取信息?
- c# - 以编程方式从 Entity Framework 6 的对象上下文中获取有关索引和约束的元数据
- algorithm - 最大匹配算法改进
- python - 我做错了什么使我的 Keras model.fit 不断抛出错误吗?
- python - 查找坐标列表是否形成循环
- java - 如何使用 JUnit 4 在 Java 控制台应用程序中测试循环的 mainManu 方法?
- css - 覆盖网页的 CSS
- php - Laravel 分页:为什么有些页面返回未定义的偏移量:0?