Browse Source

removed Guild from class name for ChannelCategory

Renamed all properties to use Category instead of Parent
Throw exception on GetUsers / GetInvites etc for categories
pull/821/head
pegasy 7 years ago
parent
commit
5c4777dc8c
19 changed files with 145 additions and 140 deletions
  1. +1
    -1
      src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs
  2. +3
    -3
      src/Discord.Net.Core/Entities/Channels/IChannelCategory.cs
  3. +2
    -2
      src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs
  4. +0
    -14
      src/Discord.Net.Core/Entities/Channels/IGuildChannelCategory.cs
  5. +3
    -1
      src/Discord.Net.Core/Entities/Guilds/IGuild.cs
  6. +1
    -1
      src/Discord.Net.Rest/API/Common/Channel.cs
  7. +0
    -14
      src/Discord.Net.Rest/API/Rest/ModifyGuildChannelCategoryParams.cs
  8. +1
    -1
      src/Discord.Net.Rest/API/Rest/ModifyGuildChannelParams.cs
  9. +3
    -3
      src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
  10. +45
    -0
      src/Discord.Net.Rest/Entities/Channels/RestChannelCategory.cs
  11. +4
    -2
      src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs
  12. +0
    -38
      src/Discord.Net.Rest/Entities/Channels/RestGuildChannelCategory.cs
  13. +9
    -0
      src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
  14. +7
    -3
      src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
  15. +2
    -2
      src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs
  16. +50
    -0
      src/Discord.Net.WebSocket/Entities/Channels/SocketChannelCategory.cs
  17. +5
    -5
      src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
  18. +0
    -46
      src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannelCategory.cs
  19. +9
    -4
      src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs

+ 1
- 1
src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs View File

@@ -29,6 +29,6 @@
/// <summary>
/// Sets the category for this channel
/// </summary>
public Optional<ulong?> ParentId { get; set; }
public Optional<ulong?> CategoryId { get; set; }
}
}

src/Discord.Net.Core/Entities/Channels/GuildChannelCategoryProperties.cs → src/Discord.Net.Core/Entities/Channels/IChannelCategory.cs View File

@@ -6,7 +6,7 @@ using System.Threading.Tasks;

namespace Discord
{
//public class GuildChannelCategoryProperties : GuildChannelProperties
//{
//}
public interface IChannelCategory : IGuildChannel
{
}
}

+ 2
- 2
src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs View File

@@ -10,9 +10,9 @@ namespace Discord
int Position { get; }

/// <summary> Gets the parentid (category) of this channel in the guild's channel list. </summary>
ulong? ParentId { get; }
ulong? CategoryId { get; }
/// <summary> Gets the parent channel (category) of this channel. </summary>
Task<IGuildChannel> GetParentChannelAsync();
Task<IChannelCategory> GetCategory();
/// <summary> Gets the guild this channel is a member of. </summary>
IGuild Guild { get; }
/// <summary> Gets the id of the guild this channel is a member of. </summary>


+ 0
- 14
src/Discord.Net.Core/Entities/Channels/IGuildChannelCategory.cs View File

@@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Discord
{
public interface IGuildChannelCategory : IGuildChannel
{
///// <summary> Modifies this text channel. </summary>
//Task ModifyAsync(Action<GuildChannelCategoryProperties> func, RequestOptions options = null);
}
}

+ 3
- 1
src/Discord.Net.Core/Entities/Guilds/IGuild.cs View File

@@ -84,7 +84,7 @@ namespace Discord
Task<IReadOnlyCollection<ITextChannel>> GetTextChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task<ITextChannel> GetTextChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task<IReadOnlyCollection<IVoiceChannel>> GetVoiceChannelsAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task<IReadOnlyCollection<IGuildChannelCategory>> GetChannelCategoriesAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task<IReadOnlyCollection<IChannelCategory>> GetChannelCategoriesAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task<IVoiceChannel> GetVoiceChannelAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task<IVoiceChannel> GetAFKChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
Task<ITextChannel> GetSystemChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
@@ -94,6 +94,8 @@ namespace Discord
Task<ITextChannel> CreateTextChannelAsync(string name, RequestOptions options = null);
/// <summary> Creates a new voice channel. </summary>
Task<IVoiceChannel> CreateVoiceChannelAsync(string name, RequestOptions options = null);
/// <summary> Creates a new channel category. </summary>
Task<IChannelCategory> CreateChannelCategoryAsync(string name, RequestOptions options = null);

Task<IReadOnlyCollection<IGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null);
Task<IGuildIntegration> CreateIntegrationAsync(ulong id, string type, RequestOptions options = null);


+ 1
- 1
src/Discord.Net.Rest/API/Common/Channel.cs View File

@@ -24,7 +24,7 @@ namespace Discord.API
[JsonProperty("permission_overwrites")]
public Optional<Overwrite[]> PermissionOverwrites { get; set; }
[JsonProperty("parent_id")]
public ulong? ParentId { get; set; }
public ulong? CategoryId { get; set; }

//TextChannel
[JsonProperty("topic")]


+ 0
- 14
src/Discord.Net.Rest/API/Rest/ModifyGuildChannelCategoryParams.cs View File

@@ -1,14 +0,0 @@
#pragma warning disable CS1591
using Newtonsoft.Json;

namespace Discord.API.Rest
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
internal class ModifyGuildChannelCategoryParams
{
[JsonProperty("name")]
public Optional<string> Name { get; set; }
[JsonProperty("position")]
public Optional<int> Position { get; set; }
}
}

+ 1
- 1
src/Discord.Net.Rest/API/Rest/ModifyGuildChannelParams.cs View File

@@ -11,6 +11,6 @@ namespace Discord.API.Rest
[JsonProperty("position")]
public Optional<int> Position { get; set; }
[JsonProperty("parent_id")]
public Optional<ulong?> ParentId { get; set; }
public Optional<ulong?> CategoryId { get; set; }
}
}

+ 3
- 3
src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs View File

@@ -28,7 +28,7 @@ namespace Discord.Rest
{
Name = args.Name,
Position = args.Position,
ParentId = args.ParentId
CategoryId = args.CategoryId
};
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
}
@@ -42,7 +42,7 @@ namespace Discord.Rest
{
Name = args.Name,
Position = args.Position,
ParentId = args.ParentId,
CategoryId = args.CategoryId,
Topic = args.Topic,
IsNsfw = args.IsNsfw
};
@@ -59,7 +59,7 @@ namespace Discord.Rest
Bitrate = args.Bitrate,
Name = args.Name,
Position = args.Position,
ParentId = args.ParentId,
CategoryId = args.CategoryId,
UserLimit = args.UserLimit.IsSpecified ? (args.UserLimit.Value ?? 0) : Optional.Create<int>()
};
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);


+ 45
- 0
src/Discord.Net.Rest/Entities/Channels/RestChannelCategory.cs View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Model = Discord.API.Channel;

namespace Discord.Rest
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class RestChannelCategory : RestGuildChannel, IChannelCategory
{
public string Mention => MentionUtils.MentionChannel(Id);

internal RestChannelCategory(BaseDiscordClient discord, IGuild guild, ulong id)
: base(discord, guild, id)
{
}
internal new static RestChannelCategory Create(BaseDiscordClient discord, IGuild guild, Model model)
{
var entity = new RestChannelCategory(discord, guild, model.Id);
entity.Update(model);
return entity;
}

private string DebuggerDisplay => $"{Name} ({Id}, Category)";

// IGuildChannel
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> throw new NotSupportedException();
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> throw new NotSupportedException();
Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options)
=> throw new NotSupportedException();
Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options)
=> throw new NotSupportedException();

//IChannel
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> throw new NotSupportedException();
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> throw new NotSupportedException();
}
}

+ 4
- 2
src/Discord.Net.Rest/Entities/Channels/RestGuildChannel.cs View File

@@ -16,8 +16,8 @@ namespace Discord.Rest
internal IGuild Guild { get; }
public string Name { get; private set; }
public int Position { get; private set; }
public ulong? ParentId { get; private set; }
public Task<IGuildChannel> GetParentChannelAsync() => ParentId == null ? null : Guild.GetChannelAsync(ParentId.Value);
public ulong? CategoryId { get; private set; }
public async Task<IChannelCategory> GetCategory() => CategoryId == null ? null : await Guild.GetChannelAsync(CategoryId.Value) as IChannelCategory;

public ulong GuildId => Guild.Id;

@@ -34,6 +34,8 @@ namespace Discord.Rest
return RestTextChannel.Create(discord, guild, model);
case ChannelType.Voice:
return RestVoiceChannel.Create(discord, guild, model);
case ChannelType.Category:
return RestChannelCategory.Create(discord, guild, model);
default:
// TODO: Channel categories
return new RestGuildChannel(discord, guild, model.Id);


+ 0
- 38
src/Discord.Net.Rest/Entities/Channels/RestGuildChannelCategory.cs View File

@@ -1,38 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Model = Discord.API.Channel;

namespace Discord.Rest
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class RestGuildChannelCategory : RestGuildChannel, IGuildChannelCategory
{
public string Mention => MentionUtils.MentionChannel(Id);

internal RestGuildChannelCategory(BaseDiscordClient discord, IGuild guild, ulong id)
: base(discord, guild, id)
{
}
internal new static RestGuildChannelCategory Create(BaseDiscordClient discord, IGuild guild, Model model)
{
var entity = new RestGuildChannelCategory(discord, guild, model.Id);
entity.Update(model);
return entity;
}
internal override void Update(Model model)
{
base.Update(model);
}

public Task<RestGuildUser> GetUserAsync(ulong id, RequestOptions options = null)
=> ChannelHelper.GetUserAsync(this, Guild, Discord, id, options);
public IAsyncEnumerable<IReadOnlyCollection<RestGuildUser>> GetUsersAsync(RequestOptions options = null)
=> ChannelHelper.GetUsersAsync(this, Guild, Discord, null, null, options);

private string DebuggerDisplay => $"{Name} ({Id}, Text)";
}
}

+ 9
- 0
src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs View File

@@ -157,6 +157,15 @@ namespace Discord.Rest
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
return RestVoiceChannel.Create(client, guild, model);
}
public static async Task<RestChannelCategory> CreateChannelCategoryAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options)
{
if (name == null) throw new ArgumentNullException(nameof(name));

var args = new CreateGuildChannelParams(name, ChannelType.Category);
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
return RestChannelCategory.Create(client, guild, model);
}

//Integrations
public static async Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(IGuild guild, BaseDiscordClient client,


+ 7
- 3
src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs View File

@@ -176,10 +176,10 @@ namespace Discord.Rest
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
return channels.Select(x => x as RestVoiceChannel).Where(x => x != null).ToImmutableArray();
}
public async Task<IReadOnlyCollection<RestGuildChannelCategory>> GetChannelCategoriesAsync(RequestOptions options = null)
public async Task<IReadOnlyCollection<RestChannelCategory>> GetChannelCategoriesAsync(RequestOptions options = null)
{
var channels = await GuildHelper.GetChannelsAsync(this, Discord, options).ConfigureAwait(false);
return channels.Select(x => x as RestGuildChannelCategory).Where(x => x != null).ToImmutableArray();
return channels.Select(x => x as RestChannelCategory).Where(x => x != null).ToImmutableArray();
}

public async Task<RestVoiceChannel> GetAFKChannelAsync(RequestOptions options = null)
@@ -222,6 +222,8 @@ namespace Discord.Rest
=> GuildHelper.CreateTextChannelAsync(this, Discord, name, options);
public Task<RestVoiceChannel> CreateVoiceChannelAsync(string name, RequestOptions options = null)
=> GuildHelper.CreateVoiceChannelAsync(this, Discord, name, options);
public Task<RestChannelCategory> CreateChannelCategoryAsync(string name, RequestOptions options = null)
=> GuildHelper.CreateChannelCategoryAsync(this, Discord, name, options);

//Integrations
public Task<IReadOnlyCollection<RestGuildIntegration>> GetIntegrationsAsync(RequestOptions options = null)
@@ -309,7 +311,7 @@ namespace Discord.Rest
else
return ImmutableArray.Create<IVoiceChannel>();
}
async Task<IReadOnlyCollection<IGuildChannelCategory>> IGuild.GetChannelCategoriesAsync(CacheMode mode , RequestOptions options)
async Task<IReadOnlyCollection<IChannelCategory>> IGuild.GetChannelCategoriesAsync(CacheMode mode , RequestOptions options)
{
if (mode == CacheMode.AllowDownload)
return await GetChannelCategoriesAsync(options).ConfigureAwait(false);
@@ -355,6 +357,8 @@ namespace Discord.Rest
=> await CreateTextChannelAsync(name, options).ConfigureAwait(false);
async Task<IVoiceChannel> IGuild.CreateVoiceChannelAsync(string name, RequestOptions options)
=> await CreateVoiceChannelAsync(name, options).ConfigureAwait(false);
async Task<IChannelCategory> IGuild.CreateChannelCategoryAsync(string name, RequestOptions options)
=> await CreateChannelCategoryAsync(name, options).ConfigureAwait(false);

async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options)
=> await GetIntegrationsAsync(options).ConfigureAwait(false);


+ 2
- 2
src/Discord.Net.Rpc/Entities/Channels/RpcGuildChannel.cs View File

@@ -10,7 +10,7 @@ namespace Discord.Rpc
{
public ulong GuildId { get; }
public int Position { get; private set; }
public ulong? ParentId { get; private set; }
public ulong? CategoryId { get; private set; }

internal RpcGuildChannel(DiscordRpcClient discord, ulong id, ulong guildId)
: base(discord, id)
@@ -58,7 +58,7 @@ namespace Discord.Rpc
public override string ToString() => Name;

//IGuildChannel
public Task<IGuildChannel> GetParentChannelAsync()
public Task<IChannelCategory> GetCategory()
{
//Always fails
throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object.");


+ 50
- 0
src/Discord.Net.WebSocket/Entities/Channels/SocketChannelCategory.cs View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Audio;
using Discord.Rest;
using Model = Discord.API.Channel;

namespace Discord.WebSocket
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketChannelCategory : SocketGuildChannel, IChannelCategory
{
public override IReadOnlyCollection<SocketGuildUser> Users
=> Guild.Users.Where(x => x.VoiceChannel?.Id == Id).ToImmutableArray();

internal SocketChannelCategory(DiscordSocketClient discord, ulong id, SocketGuild guild)
: base(discord, id, guild)
{
}
internal new static SocketChannelCategory Create(SocketGuild guild, ClientState state, Model model)
{
var entity = new SocketChannelCategory(guild.Discord, model.Id, guild);
entity.Update(state, model);
return entity;
}

private string DebuggerDisplay => $"{Name} ({Id}, Category)";
internal new SocketChannelCategory Clone() => MemberwiseClone() as SocketChannelCategory;

// IGuildChannel
IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> throw new NotSupportedException();
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> throw new NotSupportedException();
Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options)
=> throw new NotSupportedException();
Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options)
=> throw new NotSupportedException();

//IChannel
IAsyncEnumerable<IReadOnlyCollection<IUser>> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> throw new NotSupportedException();
Task<IUser> IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> throw new NotSupportedException();
}
}

+ 5
- 5
src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs View File

@@ -17,9 +17,9 @@ namespace Discord.WebSocket
public SocketGuild Guild { get; }
public string Name { get; private set; }
public int Position { get; private set; }
public ulong? ParentId { get; private set; }
public IGuildChannel ParentChannel => ParentId == null ? null : Guild.GetChannel(ParentId.Value);
public Task<IGuildChannel> GetParentChannelAsync() => Task.FromResult(ParentChannel);
public ulong? CategoryId { get; private set; }
public IChannelCategory Category => CategoryId == null ? null : Guild.GetChannel(CategoryId.Value) as IChannelCategory;
Task<IChannelCategory> IGuildChannel.GetCategory() => Task.FromResult(Category);

public IReadOnlyCollection<Overwrite> PermissionOverwrites => _overwrites;
public new virtual IReadOnlyCollection<SocketGuildUser> Users => ImmutableArray.Create<SocketGuildUser>();
@@ -38,7 +38,7 @@ namespace Discord.WebSocket
case ChannelType.Voice:
return SocketVoiceChannel.Create(guild, state, model);
case ChannelType.Category:
return SocketGuildChannelCategory.Create(guild, state, model);
return SocketChannelCategory.Create(guild, state, model);
default:
// TODO: Proper implementation for channel categories
return new SocketGuildChannel(guild.Discord, model.Id, guild);
@@ -48,7 +48,7 @@ namespace Discord.WebSocket
{
Name = model.Name.Value;
Position = model.Position.Value;
ParentId = model.ParentId;
CategoryId = model.CategoryId;

var overwrites = model.PermissionOverwrites.Value;
var newOverwrites = ImmutableArray.CreateBuilder<Overwrite>(overwrites.Length);


+ 0
- 46
src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannelCategory.cs View File

@@ -1,46 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Discord.Audio;
using Discord.Rest;
using Model = Discord.API.Channel;

namespace Discord.WebSocket
{
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketGuildChannelCategory : SocketGuildChannel, IGuildChannelCategory
{
public override IReadOnlyCollection<SocketGuildUser> Users
=> Guild.Users.Where(x => x.VoiceChannel?.Id == Id).ToImmutableArray();

internal SocketGuildChannelCategory(DiscordSocketClient discord, ulong id, SocketGuild guild)
: base(discord, id, guild)
{
}
internal new static SocketGuildChannelCategory Create(SocketGuild guild, ClientState state, Model model)
{
var entity = new SocketGuildChannelCategory(guild.Discord, model.Id, guild);
entity.Update(state, model);
return entity;
}
internal override void Update(ClientState state, Model model)
{
base.Update(state, model);
}

public override SocketGuildUser GetUser(ulong id)
{
var user = Guild.GetUser(id);
if (user?.VoiceChannel?.Id == Id)
return user;
return null;
}

private string DebuggerDisplay => $"{Name} ({Id}, Category)";
internal new SocketGuildChannelCategory Clone() => MemberwiseClone() as SocketGuildChannelCategory;
}
}

+ 9
- 4
src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs View File

@@ -94,8 +94,8 @@ namespace Discord.WebSocket
=> Channels.Select(x => x as SocketTextChannel).Where(x => x != null).ToImmutableArray();
public IReadOnlyCollection<SocketVoiceChannel> VoiceChannels
=> Channels.Select(x => x as SocketVoiceChannel).Where(x => x != null).ToImmutableArray();
public IReadOnlyCollection<SocketGuildChannelCategory> ChannelCategories
=> Channels.Select(x => x as SocketGuildChannelCategory).Where(x => x != null).ToImmutableArray();
public IReadOnlyCollection<SocketChannelCategory> ChannelCategories
=> Channels.Select(x => x as SocketChannelCategory).Where(x => x != null).ToImmutableArray();
public SocketGuildUser CurrentUser => _members.TryGetValue(Discord.CurrentUser.Id, out SocketGuildUser member) ? member : null;
public SocketRole EveryoneRole => GetRole(Id);
public IReadOnlyCollection<SocketGuildChannel> Channels
@@ -318,6 +318,9 @@ namespace Discord.WebSocket
=> GuildHelper.CreateTextChannelAsync(this, Discord, name, options);
public Task<RestVoiceChannel> CreateVoiceChannelAsync(string name, RequestOptions options = null)
=> GuildHelper.CreateVoiceChannelAsync(this, Discord, name, options);
public Task<RestChannelCategory> CreateChannelCategoryAsync(string name, RequestOptions options = null)
=> GuildHelper.CreateChannelCategoryAsync(this, Discord, name, options);

internal SocketGuildChannel AddChannel(ClientState state, ChannelModel model)
{
var channel = SocketGuildChannel.Create(this, state, model);
@@ -636,8 +639,8 @@ namespace Discord.WebSocket
=> Task.FromResult<ITextChannel>(GetTextChannel(id));
Task<IReadOnlyCollection<IVoiceChannel>> IGuild.GetVoiceChannelsAsync(CacheMode mode, RequestOptions options)
=> Task.FromResult<IReadOnlyCollection<IVoiceChannel>>(VoiceChannels);
Task<IReadOnlyCollection<IGuildChannelCategory>> IGuild.GetChannelCategoriesAsync(CacheMode mode , RequestOptions options)
=> Task.FromResult<IReadOnlyCollection<IGuildChannelCategory>>(ChannelCategories);
Task<IReadOnlyCollection<IChannelCategory>> IGuild.GetChannelCategoriesAsync(CacheMode mode , RequestOptions options)
=> Task.FromResult<IReadOnlyCollection<IChannelCategory>>(ChannelCategories);
Task<IVoiceChannel> IGuild.GetVoiceChannelAsync(ulong id, CacheMode mode, RequestOptions options)
=> Task.FromResult<IVoiceChannel>(GetVoiceChannel(id));
Task<IVoiceChannel> IGuild.GetAFKChannelAsync(CacheMode mode, RequestOptions options)
@@ -652,6 +655,8 @@ namespace Discord.WebSocket
=> await CreateTextChannelAsync(name, options).ConfigureAwait(false);
async Task<IVoiceChannel> IGuild.CreateVoiceChannelAsync(string name, RequestOptions options)
=> await CreateVoiceChannelAsync(name, options).ConfigureAwait(false);
async Task<IChannelCategory> IGuild.CreateChannelCategoryAsync(string name, RequestOptions options)
=> await CreateChannelCategoryAsync(name, options).ConfigureAwait(false);

async Task<IReadOnlyCollection<IGuildIntegration>> IGuild.GetIntegrationsAsync(RequestOptions options)
=> await GetIntegrationsAsync(options).ConfigureAwait(false);


Loading…
Cancel
Save