[Feature] Media channel support (#2725)
* initial commit * oops * another typo -_- * Update AttachmentFlags.cs Made this on my phone lol * Update AttachmentFlags.cs * -line * initial impl * some guild methods for media (and forum) channels * file attachment can be a thumbnail * can't edit media channel layout * updatess * Update ChannelPermissions.cs * typo
This commit is contained in:
@@ -339,6 +339,15 @@ namespace Discord.WebSocket
|
||||
public IReadOnlyCollection<SocketForumChannel> ForumChannels
|
||||
=> Channels.OfType<SocketForumChannel>().ToImmutableArray();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of all media channels in this guild.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A read-only collection of forum channels found within this guild.
|
||||
/// </returns>
|
||||
public IReadOnlyCollection<SocketMediaChannel> MediaChannels
|
||||
=> Channels.OfType<SocketMediaChannel>().ToImmutableArray();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current logged-in user.
|
||||
/// </summary>
|
||||
@@ -790,6 +799,16 @@ namespace Discord.WebSocket
|
||||
public SocketCategoryChannel GetCategoryChannel(ulong id)
|
||||
=> GetChannel(id) as SocketCategoryChannel;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a media channel in this guild.
|
||||
/// </summary>
|
||||
/// <param name="id">The snowflake identifier for the stage channel.</param>
|
||||
/// <returns>
|
||||
/// A stage channel associated with the specified <paramref name="id" />; <see langword="null"/> if none is found.
|
||||
/// </returns>
|
||||
public SocketMediaChannel GetMediaChannel(ulong id)
|
||||
=> GetChannel(id) as SocketMediaChannel;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new text channel in this guild.
|
||||
/// </summary>
|
||||
@@ -857,7 +876,7 @@ namespace Discord.WebSocket
|
||||
=> GuildHelper.CreateCategoryChannelAsync(this, Discord, name, options, func);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new channel forum in this guild.
|
||||
/// Creates a new forum channel in this guild.
|
||||
/// </summary>
|
||||
/// <param name="name">The new name for the forum.</param>
|
||||
/// <param name="func">The delegate containing the properties to be applied to the channel upon its creation.</param>
|
||||
@@ -870,6 +889,20 @@ namespace Discord.WebSocket
|
||||
public Task<RestForumChannel> CreateForumChannelAsync(string name, Action<ForumChannelProperties> func = null, RequestOptions options = null)
|
||||
=> GuildHelper.CreateForumChannelAsync(this, Discord, name, options, func);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new media channel in this guild.
|
||||
/// </summary>
|
||||
/// <param name="name">The new name for the media channel.</param>
|
||||
/// <param name="func">The delegate containing the properties to be applied to the channel upon its creation.</param>
|
||||
/// <param name="options">The options to be used when sending the request.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="name"/> is <see langword="null"/>.</exception>
|
||||
/// <returns>
|
||||
/// A task that represents the asynchronous creation operation. The task result contains the newly created
|
||||
/// media channel.
|
||||
/// </returns>
|
||||
public Task<RestMediaChannel> CreateMediaChannelAsync(string name, Action<ForumChannelProperties> func = null, RequestOptions options = null)
|
||||
=> GuildHelper.CreateMediaChannelAsync(this, Discord, name, options, func);
|
||||
|
||||
internal SocketGuildChannel AddChannel(ClientState state, ChannelModel model)
|
||||
{
|
||||
var channel = SocketGuildChannel.Create(this, state, model);
|
||||
@@ -2075,6 +2108,21 @@ namespace Discord.WebSocket
|
||||
/// <inheritdoc />
|
||||
Task<ITextChannel> IGuild.GetPublicUpdatesChannelAsync(CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<ITextChannel>(PublicUpdatesChannel);
|
||||
|
||||
/// <inheritdoc />
|
||||
Task<IForumChannel> IGuild.GetForumChannelAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IForumChannel>(GetForumChannel(id));
|
||||
/// <inheritdoc />
|
||||
Task<IReadOnlyCollection<IForumChannel>> IGuild.GetForumChannelsAsync(CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IReadOnlyCollection<IForumChannel>>(ForumChannels);
|
||||
|
||||
/// <inheritdoc />
|
||||
Task<IMediaChannel> IGuild.GetMediaChannelAsync(ulong id, CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IMediaChannel>(GetMediaChannel(id));
|
||||
/// <inheritdoc />
|
||||
Task<IReadOnlyCollection<IMediaChannel>> IGuild.GetMediaChannelsAsync(CacheMode mode, RequestOptions options)
|
||||
=> Task.FromResult<IReadOnlyCollection<IMediaChannel>>(MediaChannels);
|
||||
|
||||
/// <inheritdoc />
|
||||
async Task<ITextChannel> IGuild.CreateTextChannelAsync(string name, Action<TextChannelProperties> func, RequestOptions options)
|
||||
=> await CreateTextChannelAsync(name, func, options).ConfigureAwait(false);
|
||||
@@ -2091,6 +2139,10 @@ namespace Discord.WebSocket
|
||||
async Task<IForumChannel> IGuild.CreateForumChannelAsync(string name, Action<ForumChannelProperties> func, RequestOptions options)
|
||||
=> await CreateForumChannelAsync(name, func, options).ConfigureAwait(false);
|
||||
|
||||
/// <inheritdoc />
|
||||
async Task<IMediaChannel> IGuild.CreateMediaChannelAsync(string name, Action<ForumChannelProperties> func, RequestOptions options)
|
||||
=> await CreateMediaChannelAsync(name, func, options).ConfigureAwait(false);
|
||||
|
||||
/// <inheritdoc />
|
||||
async Task<IReadOnlyCollection<IVoiceRegion>> IGuild.GetVoiceRegionsAsync(RequestOptions options)
|
||||
=> await GetVoiceRegionsAsync(options).ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user