Skip to content
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

guild id most be integer. #6468

Closed
wants to merge 1 commit into from
Closed

Conversation

kpopdev
Copy link
Contributor

@kpopdev kpopdev commented Oct 28, 2024

When the input is a string, you will get None. To fix this, it should be an integer.

data = await self.bot.get_cog("something").config.guild(self.bot.get_guild(channel_name)).channel_count.set(how_many_users) File "/root/redenv/lib/python3.11/site-packages/redbot/core/config.py", line 991, in guild return self._get_base_group(self.GUILD, str(guild.id))
^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'

Description of the changes

Have the changes in this PR been tested?

yes
Choose one (remove the line that doesn't apply):
-->
Yes
No

When the input is a string, you will get None. To fix this, it should be an integer.

data = await self.bot.get_cog("something").config.guild(self.bot.get_guild(channel_name)).channel_count.set(how_many_users)
File "/root/redenv/lib/python3.11/site-packages/redbot/core/config.py", line 991, in guild
return self._get_base_group(self.GUILD, str(guild.id))
                                        ^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'
@github-actions github-actions bot added the Category: Core - API - Config This is related to the `redbot.core.config` module and `redbot.core.drivers` package. label Oct 28, 2024
@Jackenmen
Copy link
Member

The changes in this PR are unnecessary (and they will break things, as showcased by the tests).

It would seem that you misinterpreted the traceback you got - what you did is you passed None to config.guild() when what it's expecting is discord.Guild. You likely have some function or property that can return discord.Guild or None and in the case you ran into it, it returned None so when you tried using it with Config, it failed.

@Jackenmen Jackenmen closed this Oct 28, 2024
@Jackenmen Jackenmen added the Closed: Invalid There is no action to be taken in response to this issue. label Oct 28, 2024
@kpopdev kpopdev deleted the patch-2 branch November 17, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Core - API - Config This is related to the `redbot.core.config` module and `redbot.core.drivers` package. Closed: Invalid There is no action to be taken in response to this issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants