Guild.owner_id type mismatch between docs and code.
Summary
Guild.owner_id documented as int, but is Optional[int] in code
Reproduction Steps
Declare return type as int and try to return owner_id. Strict type checking enabled in vscode.
Minimal Reproducible Code
def get_guild_owner_id(guild: disnake.Guild) -> int:
return guild.owner_id
Expected Results
I expect owner_id to always be an int, otherwise, update the documentation to show it can also be None
Actual Results
Got an error because int | None doesn't match a return type of int
Type "int | None" is not assignable to return type "int"
Type "int | None" is not assignable to type "int"
"None" is not assignable to "int"Pylance[reportReturnType](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportReturnType)
Intents
All, while testing
System Information
- Python v3.12.4-final
- disnake v2.10.1-final
- disnake importlib.metadata: v2.10.1
- aiohttp v3.11.11
- system info: Windows 11 10.0.22631 AMD64
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
Could you please provide the link to the docs where this type is specified?
Could you please provide the link to the docs where this type is specified?
https://docs.disnake.dev/en/stable/api/guilds.html#disnake.Guild.owner_id
I checked the code and the docs and can confirm this bug. I will open a pull request within 24 hours to fix this. Could you also link the relative path to the file where this function is defined (And its line number if possible)
Guild.owner_id is defined here: https://github.com/DisnakeDev/disnake/blob/d847f505441d7ccf1ec4b63645ba8eae2cdc8882/disnake/guild.py#L625
This calls utils._get_as_snowflake() which can be found here:
https://github.com/DisnakeDev/disnake/blob/d847f505441d7ccf1ec4b63645ba8eae2cdc8882/disnake/utils.py#L489
Documentation is here in the class docstring: https://github.com/DisnakeDev/disnake/blob/d847f505441d7ccf1ec4b63645ba8eae2cdc8882/disnake/guild.py#L180
This was resolved in #1273.