-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using user token while executing fetch_users throws an HTTP error #2578
Comments
There is no |
Selfbots have long been supported by this library, but a recent change on discord's end to actually start filtering clients has broken this functionality. Bypassing this filter is likely fairly easy, it's probably just user-agent-checking, perhaps some checks on the x-super-agent headers etc, basic behavior look-ats. This change on discord's end breaks a number of selfbot-only methods. If we don't fix this, should these just be removed? Personally, given the large number of reasonable and viable uses for selfbots, as well as a personal belief that the lib shouldn't be the thing policing anyone, and that the people this was designed to be used against are still going to get around it with the bypasses described earlier, I'd like to see some methods taken to re-enable this functionality libside, or at least a more-exposed method to do so. Selfbots have a long and important history in discord, and it seems foolish to disregard them. Also, there is a |
Thanks for letting me know, looks like I am going to have to make my own API. |
just wanted to comment on this issue to say that I also ran into this, and I think it'd be nice if there were some official means for Discord to allow people to perform ad-hoc introspection tasks on a given guild with freely available data that simply isn't exposed in the client by default -- people looking to use these applications of the library may not be seeking to actively mutate state on Discord at all, but rather simply to satisfy their curiosity, e.g. I was trying to histogram the dates members joined a certain guild over time to try to graph its growth Discord makes no official distinction between those seeking to emulate Discord's functionality in full and those who merely wish to use a subset of it that's incapable of doing other users harm I can't imagine it'd be that difficult to expose this API surface for extensions that ran on people's desktops without expecting them to open and authenticate an entirely new session, they simply haven't bothered, and that irks me a little bit all things considered because now there's no way to do investigations like this it should be noted that people who can use this aren't all trying to spam people or get tool assistance in their interactions with other users |
Hi there, just decided I should comment here since nobody mentioned this yet. I had the same issue, seems like some time ago discord added an option to their developer portal which allows you to enable the intent to access member information. This is off by default, thus blocking this API call. If you go to the developer portal, then your bot account, under the |
This is also moot when you consider that this issue pertains to userbots, which can't even have intents. Please don't necrobump old issues. |
Summary
If you use a user token (as opposed to a bot token), you cannot get the non-cached users from a server. An HTTP error is thrown, meaning that it's not readily the discord.py API's fault, but the discord gateway or the http server is blocking the request. I believe there must be a way for a user token to grab non-cached users as it does it all the time in the actual app, but likely through Websockets rather than through HTTP sockets, which is why the API throws an error. This feature also doesn't work in discord.NET, JDA or discord.js.
Reproduction Steps
Log into user token, fetch users from each guild
client = discord.Client()
@client.event
async def on_ready():
for guild in client.guilds:
async for member in guild.fetch_users():
print(member.name)
client.run('<a user token>', bot=False)
Expected Results
User1
User2
User3
...
Actual Results
Ignoring exception in on_ready
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/discord/client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "/root/Documents/python/adBot/start.py", line 51, in on_ready
async for member in guild.fetch_members():
File "/usr/local/lib/python3.7/dist-packages/discord/iterators.py", line 86, in __anext__
msg = await self.next()
File "/usr/local/lib/python3.7/dist-packages/discord/iterators.py", line 607, in next
await self.fill_members()
File "/usr/local/lib/python3.7/dist-packages/discord/iterators.py", line 629, in fill_members
data = await self.get_members(self.guild.id, self.retrieve, after)
File "/usr/local/lib/python3.7/dist-packages/discord/http.py", line 221, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 FORBIDDEN (error code: 50001): Missing Access
Checklist
System Information
The text was updated successfully, but these errors were encountered: