Skip to content

Commit

Permalink
Set type attribute for channels to proper enum members for easier n…
Browse files Browse the repository at this point in the history
…arrowing (#67)
  • Loading branch information
Jackenmen authored Apr 8, 2021
1 parent f1899aa commit 229c54a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions discord-stubs/channel.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
from typing import Callable, Dict, Iterable, List, Optional, Union, overload
from typing_extensions import Literal

import discord.abc

Expand All @@ -21,7 +22,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
slowmode_delay: int
nsfw: bool
@property
def type(self) -> ChannelType: ...
def type(self) -> Literal[ChannelType.text, ChannelType.news]: ...
def permissions_for(self, member: Member) -> Permissions: ...
@property
def members(self) -> List[Member]: ...
Expand Down Expand Up @@ -80,7 +81,7 @@ class VocalGuildChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hasha

class VoiceChannel(VocalGuildChannel):
@property
def type(self) -> ChannelType: ...
def type(self) -> Literal[ChannelType.voice]: ...
async def edit(
self,
*,
Expand All @@ -100,7 +101,7 @@ class StageChannel(VocalGuildChannel):
@property
def requesting_to_speak(self) -> List[Member]: ...
@property
def type(self) -> ChannelType: ...
def type(self) -> Literal[ChannelType.stage_voice]: ...
async def edit(
self,
*,
Expand All @@ -117,7 +118,7 @@ class StageChannel(VocalGuildChannel):
class CategoryChannel(discord.abc.GuildChannel, Hashable):
nsfw: bool
@property
def type(self) -> ChannelType: ...
def type(self) -> Literal[ChannelType.category]: ...
def is_nsfw(self) -> bool: ...
async def edit(
self,
Expand Down Expand Up @@ -212,7 +213,7 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
class StoreChannel(discord.abc.GuildChannel, Hashable):
nsfw: bool
@property
def type(self) -> ChannelType: ...
def type(self) -> Literal[ChannelType.store]: ...
def permissions_for(self, member: Member) -> Permissions: ...
def is_nsfw(self) -> bool: ...
async def edit(
Expand All @@ -232,7 +233,7 @@ class DMChannel(discord.abc.Messageable, Hashable):
recipient: User
me: ClientUser
@property
def type(self) -> ChannelType: ...
def type(self) -> Literal[ChannelType.private]: ...
@property
def created_at(self) -> datetime.datetime: ...
def permissions_for(self, user: Optional[BaseUser] = ...) -> Permissions: ...
Expand All @@ -246,7 +247,7 @@ class GroupChannel(discord.abc.Messageable, Hashable):
name: Optional[str]
recipients: List[User]
@property
def type(self) -> ChannelType: ...
def type(self) -> Literal[ChannelType.group]: ...
@property
def icon_url(self) -> Asset: ...
def icon_url_as(
Expand Down

0 comments on commit 229c54a

Please sign in to comment.