question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation: document the type expected by Client.get_channel

See original GitHub issue

The 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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nihaalscommented, Jul 23, 2019

I think with #1497 this will become less likely with other methods as IDEs will flag it up when using the wrong type

0reactions
Morwenncommented, Jul 23, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Reference - discord.py
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API. async with x....
Read more >
Updating from v12 to v13 - discord.js Guide
Threads are a new type of sub-channel that can be used to help separate ... Many methods in discord.js that were documented as...
Read more >
client.GetChannel(%channelID%) return null - Stack Overflow
GetChannel (%channelID%) (Client is property of type DiscordSocketClient in my bot class) but that method return me only null and I just cant ......
Read more >
Discord Developer Portal — Documentation — Channel
Channel Object. Represents a guild or DM channel within Discord. Channel Structure. Field, Type, Description ...
Read more >
GetChannel - Amazon IVS
Gets the channel configuration for the specified channel ARN. See also BatchGetChannel. Request Syntax. POST /GetChannel HTTP/1.1 Content-type: application/json ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found