diff --git a/discord/abc.py b/discord/abc.py index 4e4bfd8c8..f5b5703aa 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -501,6 +501,14 @@ class GuildChannel: """:class:`str`: The string that allows you to mention the channel.""" 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 def created_at(self) -> datetime: """:class:`datetime.datetime`: Returns the channel's creation time in UTC.""" diff --git a/discord/channel.py b/discord/channel.py index 204bba8cd..55ce604eb 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -2314,6 +2314,14 @@ class DMChannel(discord.abc.Messageable, Hashable): """:class:`ChannelType`: The channel's Discord type.""" 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 def created_at(self) -> datetime.datetime: """: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.""" 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: """Handles permission resolution for a :class:`User`.