Documentation: document the type expected by Client.get_channel
See original GitHub issueThe Problem
It is unclear from the documentation which type is expected from Client.get_channel
, and from what I gathered said type changed sometime in history so some pieces of code don’t work for non_obvious reasons. Moreover, passing the wrong type to get_channel
doesn’t cause it to crash but to return None
instead, making the issue silent.
I’m actually opening this issue because it took me much more time to find where the problem was than it should have.
The Ideal Solution
The simplest and most conservative solution is to simply document the type expected by Client.get_channel
.
Alternative solutions would be to accept either int
or str
as an id and convert accordingly, or to throw a TypeError
when the type passed to function is not the one it expected, but both sound like breaking changes, so even a simple note in the documentation seems good enough.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
I think with #1497 this will become less likely with other methods as IDEs will flag it up when using the wrong type
I guess that people who found it was an
int
indeed just remembered it and went on without having to give it a second though, it was purely an issue of discoverability.