Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Has something changed? KeyError: 'Could not find member with id [bot-id here]' #31

Closed
Fuzzwah opened this issue Nov 1, 2020 · 3 comments

Comments

@Fuzzwah
Copy link

Fuzzwah commented Nov 1, 2020

Had a test bot up and running happily for a while now, but today found that it would error when I ran it.

  File "/home/fuz/iracing-stats/.env/lib/python3.7/site-packages/discord/client.py", line 312, in _run_event
    await coro(*args, **kwargs)
  File "/home/fuz/iracing-stats/.env/lib/python3.7/site-packages/distest/bot.py", line 240, in on_ready
    await self.run_tests(self._channel, self._test_to_run)
  File "/home/fuz/iracing-stats/.env/lib/python3.7/site-packages/distest/bot.py", line 183, in run_tests
    await self._run_by_predicate(channel)
  File "/home/fuz/iracing-stats/.env/lib/python3.7/site-packages/distest/bot.py", line 106, in _run_by_predicate
    await self.run_test(test, channel, stop_error=True)
  File "/home/fuz/iracing-stats/.env/lib/python3.7/site-packages/distest/bot.py", line 68, in run_test
    test_interface = TestInterface(self, channel, self._find_target(channel.guild))
  File "/home/fuz/iracing-stats/.env/lib/python3.7/site-packages/distest/bot.py", line 53, in _find_target
    raise KeyError("Could not find member with id {}".format(self._target_name))
KeyError: 'Could not find member with id [bot-id here]'

Obviously where I've got [bot-id here] above, actually lists my target discord.py bot.

I did some debugging and had the test bot print out each of the guild members that it could see, but it can only apparently see it's self on the server...

@Cobular
Copy link
Owner

Cobular commented Nov 1, 2020

I certainly haven't changed anything on my end in months. This sounds like it might be a potential issue with whitelisted intents or something, but a distest testing bot likely wouldn't hit those limits. Here's some more info, let me know if you think you'd be subject to restrictions. https://support.discord.com/hc/en-us/articles/360040720412.

If you don't think that's a problem, maybe they still changed something about what can be done with what permissions. Try changing the bot to admin and see if that works, and if so, then try ramping down permissions until you find what specifically is needed (and let me know so I can update the docs lol). I'm not much of a permissions expert, but it should be pretty clear what would be responsible if this is the issue.

Another thing, although I'm not totally certain how this would work, could be that the bot can only see members that have access to channels that it can access, similar to how the online list is filtered by the users who can see a certain channel. It's possible that maybe that was misconfigured, and admin should also test for this possible issue. To be honnest, I'm not really sure if this will work, but it might be worth a try.

If neither of these things fix the problem, then I'm also at a loss. It's also 2 am here, so I'll let you know if I think of another solution sometime tomorrow.

  • Jake

@liamdj23
Copy link
Contributor

liamdj23 commented Nov 1, 2020

https://discordpy.readthedocs.io/en/latest/intents.html#where-d-my-members-go

@Cobular
Copy link
Owner

Cobular commented Nov 1, 2020

Yep this one's been fixed, will be in the next release that I'll whip up in just a sec

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants