mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Add jump_url property to channels
This commit is contained in:
parent
6265723a35
commit
348764583d
@ -501,6 +501,14 @@ class GuildChannel:
|
|||||||
""":class:`str`: The string that allows you to mention the channel."""
|
""":class:`str`: The string that allows you to mention the channel."""
|
||||||
return f'<#{self.id}>'
|
return f'<#{self.id}>'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def jump_url(self) -> str:
|
||||||
|
""":class:`str`: Returns a URL that allows the client to jump to the channel.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
"""
|
||||||
|
return f'https://discord.com/channels/{self.guild.id}/{self.id}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def created_at(self) -> datetime:
|
def created_at(self) -> datetime:
|
||||||
""":class:`datetime.datetime`: Returns the channel's creation time in UTC."""
|
""":class:`datetime.datetime`: Returns the channel's creation time in UTC."""
|
||||||
|
@ -2314,6 +2314,14 @@ class DMChannel(discord.abc.Messageable, Hashable):
|
|||||||
""":class:`ChannelType`: The channel's Discord type."""
|
""":class:`ChannelType`: The channel's Discord type."""
|
||||||
return ChannelType.private
|
return ChannelType.private
|
||||||
|
|
||||||
|
@property
|
||||||
|
def jump_url(self) -> str:
|
||||||
|
""":class:`str`: Returns a URL that allows the client to jump to the channel.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
"""
|
||||||
|
return f'https://discord.com/channels/@me/{self.id}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def created_at(self) -> datetime.datetime:
|
def created_at(self) -> datetime.datetime:
|
||||||
""":class:`datetime.datetime`: Returns the direct message channel's creation time in UTC."""
|
""":class:`datetime.datetime`: Returns the direct message channel's creation time in UTC."""
|
||||||
@ -2472,6 +2480,14 @@ class GroupChannel(discord.abc.Messageable, Hashable):
|
|||||||
""":class:`datetime.datetime`: Returns the channel's creation time in UTC."""
|
""":class:`datetime.datetime`: Returns the channel's creation time in UTC."""
|
||||||
return utils.snowflake_time(self.id)
|
return utils.snowflake_time(self.id)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def jump_url(self) -> str:
|
||||||
|
""":class:`str`: Returns a URL that allows the client to jump to the channel.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
"""
|
||||||
|
return f'https://discord.com/channels/@me/{self.id}'
|
||||||
|
|
||||||
def permissions_for(self, obj: Snowflake, /) -> Permissions:
|
def permissions_for(self, obj: Snowflake, /) -> Permissions:
|
||||||
"""Handles permission resolution for a :class:`User`.
|
"""Handles permission resolution for a :class:`User`.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user