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

Implementing GET '/channels/:id' & '/guilds/:id/channels' #2169

Closed
wants to merge 2 commits into from

Conversation

@NCPlayz
Copy link
Contributor

commented May 18, 2019

Summary

This adds the two known channel metadata endpoints, listed on #133.

  • GET /channels/:id -> Client.fetch_channel
  • GET /guilds/:id/channels -> Guild.fetch_channels

Both of these give full objects of channels, not partial objects.
You can also do Client.login -> Client.fetch_channel, or Client.login -> Client.fetch_guild -> Guild.fetch_channels.

Just a side note: weirdly enough, doing Client.fetch_channel(cannot_read_channel_id) gives Forbidden, but Guild.fetch_channels() -> utils.get id=cannot_read_channel_id doesn't.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@NCPlayz NCPlayz force-pushed the NCPlayz:channels-metadata branch 2 times, most recently from 54c01cb to ea28c93 May 18, 2019

Show resolved Hide resolved discord/client.py Outdated
Show resolved Hide resolved discord/client.py Outdated
Show resolved Hide resolved discord/client.py Outdated
Show resolved Hide resolved discord/guild.py Outdated
Show resolved Hide resolved discord/guild.py Outdated
Implementing GET '/channels/:id' & '/guilds/:id/channels'
Signed-off-by: NCPlayz <chowdhurynadir0@outlook.com>

@NCPlayz NCPlayz force-pushed the NCPlayz:channels-metadata branch from ea28c93 to ad32210 May 20, 2019

@Rapptz
Copy link
Owner

left a comment

I don't really like using TypeError for this type of runtime error. TypeError should be reserved for "parse-time" or call-time errors that are the fault of the user. The user is not at fault here -- the library is. It needs to be a different error. Unfortunately none of the exceptions in errors.py fit this whole "unknown data received" paradigm because back then the library wouldn't care. So a new exception needs to be made for this error.

Show resolved Hide resolved discord/client.py Outdated
Show resolved Hide resolved discord/client.py Outdated
Show resolved Hide resolved discord/guild.py Outdated
Show resolved Hide resolved discord/errors.py Outdated

@NCPlayz NCPlayz force-pushed the NCPlayz:channels-metadata branch from fdf8182 to 42185cb May 24, 2019

@Rapptz

Rapptz approved these changes Jun 7, 2019

@Rapptz Rapptz added this to the v1.2 milestone Jun 7, 2019

@Rapptz Rapptz added the rebased label Jun 7, 2019

@Rapptz Rapptz closed this Jun 8, 2019

@NCPlayz NCPlayz deleted the NCPlayz:channels-metadata branch Jun 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.