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

@NCPlayz NCPlayz 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 channels-metadata branch 2 times, most recently from 54c01cb to ea28c93 Compare May 19, 2019 19:26
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 Show resolved Hide resolved
Signed-off-by: NCPlayz <chowdhurynadir0@outlook.com>
Copy link
Owner

@Rapptz Rapptz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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 Show resolved Hide resolved
@Rapptz Rapptz added this to the v1.2 milestone Jun 7, 2019
@Rapptz Rapptz added the merged Tag to mark pull requests as rebased or merged label Jun 7, 2019
@Rapptz Rapptz closed this Jun 8, 2019
@NCPlayz NCPlayz deleted the channels-metadata branch June 21, 2019 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged Tag to mark pull requests as rebased or merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants