/// <inheritdoc /> /// <exception cref="ArgumentException"> /// <paramref name="filePath" /> is a zero-length string, contains only white space, or contains one or more /// invalid characters as defined by <see cref="System.IO.Path.GetInvalidPathChars"/>. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="filePath" /> is <c>null</c>. /// </exception> /// <exception cref="PathTooLongException"> /// The specified path, file name, or both exceed the system-defined maximum length. For example, on /// Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 /// characters. /// </exception> /// <exception cref="DirectoryNotFoundException"> /// The specified path is invalid, (for example, it is on an unmapped drive). /// </exception> /// <exception cref="UnauthorizedAccessException"> /// <paramref name="filePath" /> specified a directory.-or- The caller does not have the required permission. /// </exception> /// <exception cref="FileNotFoundException"> /// The file specified in <paramref name="filePath" /> was not found. /// </exception> /// <exception cref="NotSupportedException"><paramref name="filePath" /> is in an invalid format.</exception> /// <exception cref="IOException">An I/O error occurred while opening the file.</exception> /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> public Task <RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null) => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, allowedMentions, options, isSpoiler);
/// <inheritdoc /> public IAsyncEnumerable <IReadOnlyCollection <RestMessage> > GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) => ChannelHelper.GetMessagesAsync(this, Discord, null, Direction.Before, limit, options);
/// <inheritdoc /> public Task <IReadOnlyCollection <RestMessage> > GetPinnedMessagesAsync(RequestOptions options = null) => ChannelHelper.GetPinnedMessagesAsync(this, Discord, options);
/// <inheritdoc /> public async Task ModifyAsync(Action <TextChannelProperties> func, RequestOptions options = null) { var model = await ChannelHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); Update(model); }
/// <summary> /// Gets a collection of users that are able to view the channel. /// </summary> /// <param name="options">The options to be used when sending the request.</param> /// <exception cref="InvalidOperationException"> /// Resolving permissions requires the parent guild to be downloaded. /// </exception> /// <returns> /// A paged collection containing a collection of guild users that can access this channel. Flattening the /// paginated response into a collection of users with /// <see cref="AsyncEnumerableExtensions.FlattenAsync{T}"/> is required if you wish to access the users. /// </returns> public IAsyncEnumerable <IReadOnlyCollection <RestGuildUser> > GetUsersAsync(RequestOptions options = null) => ChannelHelper.GetUsersAsync(this, Guild, Discord, null, null, options);
/// <summary> /// Gets the parent (category) channel of this channel. /// </summary> /// <param name="options">The options to be used when sending the request.</param> /// <returns> /// A task that represents the asynchronous get operation. The task result contains the category channel /// representing the parent of this channel; <c>null</c> if none is set. /// </returns> public Task <ICategoryChannel> GetCategoryAsync(RequestOptions options = null) => ChannelHelper.GetCategoryAsync(this, Discord, options);
//Invites /// <inheritdoc /> public async Task <IInviteMetadata> CreateInviteAsync(int?maxAge = 86400, int?maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false);
public Task LeaveAsync(RequestOptions options = null) => ChannelHelper.DeleteAsync(this, Discord, options);
/// <inheritdoc /> /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> public Task <RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null) => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options);
/// <inheritdoc /> /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> public Task <RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null) => ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, isSpoiler, embeds);
/// <inheritdoc /> /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> public Task <RestUserMessage> SendFilesAsync(IEnumerable <FileAttachment> attachments, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null, MessageComponent components = null, ISticker[] stickers = null, Embed[] embeds = null) => ChannelHelper.SendFilesAsync(this, Discord, attachments, text, isTTS, embed, allowedMentions, messageReference, components, stickers, options, embeds);
/// <inheritdoc /> public async Task <IUserMessage> ModifyMessageAsync(ulong messageId, Action <MessageProperties> func, RequestOptions options = null) => await ChannelHelper.ModifyMessageAsync(this, messageId, func, Discord, options).ConfigureAwait(false);
/// <inheritdoc /> public async Task <IInviteMetadata> CreateInviteToApplicationAsync(ulong applicationId, int?maxAge, int?maxUses = default(int?), bool isTemporary = false, bool isUnique = false, RequestOptions options = null) => await ChannelHelper.CreateInviteToApplicationAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, applicationId, options).ConfigureAwait(false);
/// <inheritdoc /> public virtual async Task <IInviteMetadata> CreateInviteToApplicationAsync(DefaultApplications application, int?maxAge = 86400, int?maxUses = default(int?), bool isTemporary = false, bool isUnique = false, RequestOptions options = null) => await ChannelHelper.CreateInviteToApplicationAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, (ulong)application, options);
/// <summary> /// Gets a webhook available in this text channel. /// </summary> /// <param name="id">The identifier of the webhook.</param> /// <param name="options">The options to be used when sending the request.</param> /// <returns> /// A task that represents the asynchronous get operation. The task result contains a webhook associated /// with the identifier; <c>null</c> if the webhook is not found. /// </returns> public Task <RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null) => ChannelHelper.GetWebhookAsync(this, Discord, id, options);
/// <inheritdoc /> /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> public Task <RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) => ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options);
/// <summary> /// Gets the webhooks available in this text channel. /// </summary> /// <param name="options">The options to be used when sending the request.</param> /// <returns> /// A task that represents the asynchronous get operation. The task result contains a read-only collection /// of webhooks that is available in this channel. /// </returns> public Task <IReadOnlyCollection <RestWebhook> > GetWebhooksAsync(RequestOptions options = null) => ChannelHelper.GetWebhooksAsync(this, Discord, options);
/// <inheritdoc /> public Task DeleteMessageAsync(IMessage message, RequestOptions options = null) => ChannelHelper.DeleteMessageAsync(this, message.Id, Discord, options);
/// <inheritdoc /> public Task SyncPermissionsAsync(RequestOptions options = null) => ChannelHelper.SyncPermissionsAsync(this, Discord, options);
/// <inheritdoc /> public Task DeleteMessagesAsync(IEnumerable <IMessage> messages, RequestOptions options = null) => ChannelHelper.DeleteMessagesAsync(this, Discord, messages.Select(x => x.Id), options);
/// <inheritdoc /> public async Task <IReadOnlyCollection <IInviteMetadata> > GetInvitesAsync(RequestOptions options = null) => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false);
/// <inheritdoc /> public Task DeleteMessagesAsync(IEnumerable <ulong> messageIds, RequestOptions options = null) => ChannelHelper.DeleteMessagesAsync(this, Discord, messageIds, options);
/// <summary> /// Gets a user in this channel. /// </summary> /// <param name="id">The snowflake identifier of the user.</param> /// <param name="options">The options to be used when sending the request.</param> /// <exception cref="InvalidOperationException"> /// Resolving permissions requires the parent guild to be downloaded. /// </exception> /// <returns> /// A task representing the asynchronous get operation. The task result contains a guild user object that /// represents the user; <c>null</c> if none is found. /// </returns> public Task <RestGuildUser> GetUserAsync(ulong id, RequestOptions options = null) => ChannelHelper.GetUserAsync(this, Guild, Discord, id, options);
/// <inheritdoc /> public Task TriggerTypingAsync(RequestOptions options = null) => ChannelHelper.TriggerTypingAsync(this, Discord, options);
/// <inheritdoc /> public Task <RestMessage> GetMessageAsync(ulong id, RequestOptions options = null) => ChannelHelper.GetMessageAsync(this, Discord, id, options);
/// <inheritdoc /> public IDisposable EnterTypingState(RequestOptions options = null) => ChannelHelper.EnterTypingState(this, Discord, options);
/// <inheritdoc /> public IAsyncEnumerable <IReadOnlyCollection <RestMessage> > GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) => ChannelHelper.GetMessagesAsync(this, Discord, fromMessage.Id, dir, limit, options);
/// <summary> /// Creates a webhook in this text channel. /// </summary> /// <param name="name">The name of the webhook.</param> /// <param name="avatar">The avatar of the webhook.</param> /// <param name="options">The options to be used when sending the request.</param> /// <returns> /// A task that represents the asynchronous creation operation. The task result contains the newly created /// webhook. /// </returns> public Task <RestWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null) => ChannelHelper.CreateWebhookAsync(this, Discord, name, avatar, options);
/// <inheritdoc /> /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> public Task <RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReferenceParams reference = null, InteractionRow[] components = null) => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, reference, options, components);
/// <inheritdoc /> /// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception> public Task <RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null) => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, allowedMentions, messageReference, options);