Added GetJumpUrl() as an extension method for IMessage (#1102)
* Added GetJumpUrl() as an IMessage extension method * Removed extra line for consistency * Moved the namespace from Discord.Commands to Discord * lint: remove eof newline * lint: use TextChannel to get GuildID
This commit is contained in:
committed by
Christopher F
parent
aadd6f639f
commit
afc3a9d063
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Discord.Commands
|
namespace Discord.Commands
|
||||||
{
|
{
|
||||||
@@ -43,4 +43,4 @@ namespace Discord.Commands
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
src/Discord.Net.Core/Extensions/MessageExtensions.cs
Normal file
11
src/Discord.Net.Core/Extensions/MessageExtensions.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace Discord
|
||||||
|
{
|
||||||
|
public static class MessageExtensions
|
||||||
|
{
|
||||||
|
public static string GetJumpUrl(this IMessage msg)
|
||||||
|
{
|
||||||
|
var channel = msg.Channel;
|
||||||
|
return $"https://discordapp.com/channels/{(channel is IDMChannel ? "@me" : $"{(channel as ITextChannel).GuildId}")}/{channel.Id}/{msg.Id}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user