Nonetype object has no attribute id on ;meta guilds
Closed this issue · 5 comments
I just installed TLE on a Ubuntu 20.04 DigitalOcean Droplet and I'm having trouble with the ;handle
command. It registers users correctly but when trying ;handle list
I get the error "No members with registered handles." I checked poetry.lock and discord.py is correctly set on version 1.4.2 so I'm unsure about what's happening.
Also, I'm getting an error on ;meta guilds
which might be relevant:
06-11-2020 18:29:05:ERROR:tle.util.discord_common:Ignoring exception in command meta guilds:
Traceback (most recent call last):
File "/root/.cache/pypoetry/virtualenvs/tle-F1GuQE82-py3.8/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(args, **kwargs)
File "/root/dev/programs/TLE/tle/cogs/meta.py", line 95, in guilds
msg = [f'Guild ID: {guild.id} | Name: {guild.name} | Owner: {guild.owner.id} | Icon: {guild.icon_url}'
File "/root/dev/programs/TLE/tle/cogs/meta.py", line 95, in <listcomp>
msg = [f'Guild ID: {guild.id} | Name: {guild.name} | Owner: {guild.owner.id} | Icon: {guild.icon_url}'
AttributeError: 'NoneType' object has no attribute 'id'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/.cache/pypoetry/virtualenvs/tle-F1GuQE82-py3.8/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "/root/.cache/pypoetry/virtualenvs/tle-F1GuQE82-py3.8/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1302, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "/root/.cache/pypoetry/virtualenvs/tle-F1GuQE82-py3.8/lib/python3.8/site-packages/discord/ext/commands/core.py", line 850, in invoke
await injected(ctx.args, **ctx.kwargs)
File "/root/.cache/pypoetry/virtualenvs/tle-F1GuQE82-py3.8/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'
I was playing around a bit with the code so I updated to Discord 1.5.0 + made minimal changes and it seemed to do the trick. However I'm not sure if it breaks other features.
Specifically:
- Changed the pyproject.toml file to use discord.py 1.5.0
- On tle/main.py, imported discord and around lines 62-63 replaced the bot definition to allow for all Intents:
1 import discord
...
62 intents = discord.Intents.all()
63 bot = commands.Bot(command_prefix=commands.when_mentioned_or(';'), intents=intents)
- I checked the boxes of "PRESENCE INTENT" and "SERVER MEMBERS INTENT" on the Developer Portal.
My guess is that point 3 is what fixed it for me. On the docs (https://discord.com/developers/docs/topics/gateway#gateway-intents) it says the following:
On October 7, 2020 the events under the GUILD_PRESENCES and GUILD_MEMBERS intents will be turned off by default on all gateway versions. If you are using Gateway v6, you will receive those events if you have enabled the flags for those intents in the Developer Portal and have been verified if your bot is in 100 or more guilds. You do not need to use Intents on Gateway v6 to receive these events; you just need to enable the flags.
To my understanding this might imply that all new users of TLE will have to do this additional step in order for the bot to work. Hope it helps.
@dgcnz Can you please send a PR with the changes you made? Preferably along with appropriate changes in README.md for new users.
@aryanc403 Done :)