Browse Source

Additional documentation included.

pull/1530/head
Matt Smith 5 years ago
parent
commit
549df5783c
3 changed files with 9 additions and 2 deletions
  1. +5
    -2
      src/Discord.Net.Core/Entities/Messages/IUserMessage.cs
  2. +2
    -0
      src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs
  3. +2
    -0
      src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs

+ 5
- 2
src/Discord.Net.Core/Entities/Messages/IUserMessage.cs View File

@@ -58,14 +58,17 @@ namespace Discord
Task UnpinAsync(RequestOptions options = null);

/// <summary>
/// Publish (crosspost) this message.
/// Publishes (crossposts) this message.
/// </summary>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>
/// A task that represents the asynchronous operation for publishing this message.
/// </returns>
/// <remarks>
/// Publishing (crossposting) is only available in news channels.
/// <note type="warning">
/// This call will throw an <see cref="InvalidOperationException"/> if attempted in a non-news channel.
/// </note>
/// This method will publish (crosspost) the message. Please note, publishing (crossposting), is only available in news channels.
/// </remarks>
Task CrosspostAsync(RequestOptions options = null);



+ 2
- 0
src/Discord.Net.Rest/Entities/Messages/RestUserMessage.cs View File

@@ -149,8 +149,10 @@ namespace Discord.Rest
=> MentionUtils.Resolve(this, 0, userHandling, channelHandling, roleHandling, everyoneHandling, emojiHandling);

/// <inheritdoc />
/// <exception cref="InvalidOperationException">This operation may only be called on a <see cref="RestNewsChannel"/> channel.</exception>
public async Task CrosspostAsync(RequestOptions options = null)
{
// Validate that the channel is of type RestNewsChannel
if (!(Channel is RestNewsChannel))
{
throw new InvalidOperationException("Publishing (crossposting) is only valid in news channels.");


+ 2
- 0
src/Discord.Net.WebSocket/Entities/Messages/SocketUserMessage.cs View File

@@ -149,8 +149,10 @@ namespace Discord.WebSocket
=> MentionUtils.Resolve(this, 0, userHandling, channelHandling, roleHandling, everyoneHandling, emojiHandling);

/// <inheritdoc />
/// <exception cref="InvalidOperationException">This operation may only be called on a <see cref="SocketNewsChannel"/> channel.</exception>
public async Task CrosspostAsync(RequestOptions options = null)
{
// Validate that the channel is of type SocketNewsChannel
if (!(Channel is SocketNewsChannel))
{
throw new InvalidOperationException("Publishing (crossposting) is only valid in news channels.");


Loading…
Cancel
Save