@@ -58,14 +58,17 @@ namespace Discord | |||||
Task UnpinAsync(RequestOptions options = null); | Task UnpinAsync(RequestOptions options = null); | ||||
/// <summary> | /// <summary> | ||||
/// Publish (crosspost) this message. | |||||
/// Publishes (crossposts) this message. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task that represents the asynchronous operation for publishing this message. | /// A task that represents the asynchronous operation for publishing this message. | ||||
/// </returns> | /// </returns> | ||||
/// <remarks> | /// <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> | /// </remarks> | ||||
Task CrosspostAsync(RequestOptions options = null); | Task CrosspostAsync(RequestOptions options = null); | ||||
@@ -149,8 +149,10 @@ namespace Discord.Rest | |||||
=> MentionUtils.Resolve(this, 0, userHandling, channelHandling, roleHandling, everyoneHandling, emojiHandling); | => MentionUtils.Resolve(this, 0, userHandling, channelHandling, roleHandling, everyoneHandling, emojiHandling); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="InvalidOperationException">This operation may only be called on a <see cref="RestNewsChannel"/> channel.</exception> | |||||
public async Task CrosspostAsync(RequestOptions options = null) | public async Task CrosspostAsync(RequestOptions options = null) | ||||
{ | { | ||||
// Validate that the channel is of type RestNewsChannel | |||||
if (!(Channel is RestNewsChannel)) | if (!(Channel is RestNewsChannel)) | ||||
{ | { | ||||
throw new InvalidOperationException("Publishing (crossposting) is only valid in news channels."); | throw new InvalidOperationException("Publishing (crossposting) is only valid in news channels."); | ||||
@@ -149,8 +149,10 @@ namespace Discord.WebSocket | |||||
=> MentionUtils.Resolve(this, 0, userHandling, channelHandling, roleHandling, everyoneHandling, emojiHandling); | => MentionUtils.Resolve(this, 0, userHandling, channelHandling, roleHandling, everyoneHandling, emojiHandling); | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
/// <exception cref="InvalidOperationException">This operation may only be called on a <see cref="SocketNewsChannel"/> channel.</exception> | |||||
public async Task CrosspostAsync(RequestOptions options = null) | public async Task CrosspostAsync(RequestOptions options = null) | ||||
{ | { | ||||
// Validate that the channel is of type SocketNewsChannel | |||||
if (!(Channel is SocketNewsChannel)) | if (!(Channel is SocketNewsChannel)) | ||||
{ | { | ||||
throw new InvalidOperationException("Publishing (crossposting) is only valid in news channels."); | throw new InvalidOperationException("Publishing (crossposting) is only valid in news channels."); | ||||