【问题标题】:Discord REST API: get multiple usersDiscord REST API:获取多个用户
【发布时间】:2021-05-10 14:10:02
【问题描述】:

我正在尝试通过将 Discord REST API 与 Node.js 和 Unirest 模块一起使用来通过单个请求查询多个用户。

unirest.get(`https://discord.com/api/v8/users/{user.id}`).headers({ Authorization: `Bot${botSecret}`})
.then(response =>{
   console.log(response);
})
.catch(error =>{
   console.error(error);
})

为了获得多个用户,我通过以下方式在user.id 字段中传递了一个 id 列表: "id1,id2,id3"

https://discord.com/api/v8/users/id1,id2,id3

但是我收到“错误请求”响应。

用一个请求查询多个用户的正确方法是什么?

【问题讨论】:

    标签: discord unirest


    【解决方案1】:

    我快速浏览了 Discord API 和 discord.js 代码,似乎它们是单独完成的。

    Discord 的 API 似乎不支持一次获取多个用户,而 discord.js 获取了一组用户,并遍历它们同时检查缓存,确保它们不违反速率限制等。

    【讨论】:

      猜你喜欢
      • 2021-05-17
      • 2021-12-05
      • 2022-06-19
      • 2018-01-13
      • 2020-12-17
      • 2015-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多