【问题标题】:How can I get the total number of members in a discord using Discord API without adding the discord using python?如何在不使用 python 添加不和谐的情况下使用 Discord API 获取不和谐中的成员总数?
【发布时间】:2022-09-30 08:20:29
【问题描述】:

我想调查我个人所属的不和谐,但我没有成为会员的机器人。我想找出每个不和谐的大小或近似大小。目前我无法访问不和谐或不和谐的预览。

应该是可能的; discord 文档 (https://discord.com/developers/docs/resources/guild#get-guild-preview) 说,即使用户(可能是机器人)不是成员,也至少可以获得预览:

获取公会预览 GET/guilds/{guild.id}/preview 返回公会 给定 id 的预览对象。如果用户不在公会中,则 公会必须是潜伏的(它必须是可发现的或有生命的 公共舞台)。

我正在尝试的python代码是:

import requests

url_str =\"https://discordapp.com/api/guilds/\" + str(guild_id) + \'/preview\'
print(url_str)
response = requests.get(url= url_str,headers={
    \'Authorization\':\'Bot \' + bot_token})
print(response)

url_str =\"https://discordapp.com/api/guilds/\" + str(guild_id)
print(url_str)
response = requests.get(url= url_str,headers={
    \'Authorization\':\'Bot \' + bot_token})

print(response)

输出是:

https://discordapp.com/api/guilds/{guild_id}/preview <响应 [404]> https://discordapp.com/api/guilds/{guild_id} <响应 [403]>

我正在尝试做的事情可能吗?如果是这样,出了什么问题?

    标签: discord


    【解决方案1】:

    我也遇到了这个。你有没有找到解决办法?

    【讨论】:

      猜你喜欢
      • 2020-03-14
      • 2022-12-14
      • 2021-11-23
      • 2021-11-08
      • 2021-10-16
      • 1970-01-01
      • 2021-05-15
      • 2017-03-27
      • 1970-01-01
      相关资源
      最近更新 更多