Skip to content
This repository has been archived by the owner. It is now read-only.

[Feature Request] Expose Channel._type publicly to avoid multiple isinstance checks #2185

Closed
LostLuma opened this issue May 24, 2019 · 0 comments
Closed
Assignees
Milestone

Comments

@LostLuma
Copy link
Contributor

@LostLuma LostLuma commented May 24, 2019

The Problem

Trying to find the ChannelType value for a channel currently involves going through each existing channel type and performing an isinstance check to see if it matches the channel.

As channels already have the _type attribute/property it would be very convenient to expose it publicly, as the checks above could be replaced with a simply attribute access.

The Ideal Solution

_type is renamed to type and returns a ChannelType instead of the channel type value.

The Current Solution

Cycling through possible channel types and performing an isinstance check.

Summary

Expose the _type attribute/property of channels for less complex code.

@Rapptz Rapptz self-assigned this May 24, 2019
@Rapptz Rapptz added this to the v1.2 milestone Jun 9, 2019
@Rapptz Rapptz closed this in 7e2da1c Jun 9, 2019
yagomichalak pushed a commit to yagomichalak/discord.py that referenced this issue May 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants