Discord.py: Guild.bans() raises a TypeError

Created on 17 Jan 2020  路  6Comments  路  Source: Rapptz/discord.py

Summary

Calling await guild.bans() results in a TypeError

Reproduction Steps

g_bans = {x.user for x in await guild.bans()}

Expected Results

I expected it to gracefully handle this, but this seems to be a case of discord changing things without telling anyone.

Actual Results

    g_bans = {x.user for x in await guild.bans()}
  File "/root/rachael/lib/python3.8/site-packages/discord/guild.py", line 1246, in bans
    return [BanEntry(user=User(state=self._state, data=e['user']),
  File "/root/rachael/lib/python3.8/site-packages/discord/guild.py", line 1246, in <listcomp>
    return [BanEntry(user=User(state=self._state, data=e['user']),
  File "/root/rachael/lib/python3.8/site-packages/discord/user.py", line 81, in __init__
    self._update(data)
  File "/root/rachael/lib/python3.8/site-packages/discord/user.py", line 96, in _update
    self.name = data['username']
TypeError: 'NoneType' object is not subscriptable

Checklist

  • [X] I have searched the open issues for duplicates.
  • [ ] I have shown the entire traceback, if possible.
  • [X] I have removed my token from display, if visible.

System Information

  • Python v3.8.1-final
  • discord.py v1.2.5-final
  • aiohttp v3.6.2
  • websockets v6.0
  • system info: Linux 4.9.93-mainline-rev1 #1 SMP Tue Apr 10 09:54:46 UTC 2018
discord bug no repro

Most helpful comment

Issue is resolved on our end. Error should no longer occur.

All 6 comments

I can't reproduce this one. It's not in my bot's logs anywhere and I checked around 120 random guilds + 5 servers I moderate and couldn't get a single failing request.

I can offer an invite with ban perms for a bot to the server this happened in if you'd like.

This bug is on our end (discord's) - we're looking into it.

Issue is resolved on our end. Error should no longer occur.

Thanks!

@jhgg I know you said the error should no longer occur, but I've now seen this a few more times via various other users of the same code base running into an identical issue.

Was this page helpful?
0 / 5 - 0 ratings