Browse Source

feature: IVoiceChannel implements IMentionable (#1896)

tags/3.0.0
Nikon GitHub 3 years ago
parent
commit
3395700720
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions
  1. +1
    -1
      src/Discord.Net.Core/Entities/Channels/IVoiceChannel.cs
  2. +4
    -1
      src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs
  3. +5
    -0
      src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs
  4. +2
    -0
      test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs

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

@@ -6,7 +6,7 @@ namespace Discord
/// <summary>
/// Represents a generic voice channel in a guild.
/// </summary>
public interface IVoiceChannel : INestedChannel, IAudioChannel
public interface IVoiceChannel : INestedChannel, IAudioChannel, IMentionable
{
/// <summary>
/// Gets the bit-rate that the clients in this voice channel are requested to use.


+ 4
- 1
src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs View File

@@ -21,6 +21,9 @@ namespace Discord.Rest
/// <inheritdoc />
public ulong? CategoryId { get; private set; }

/// <inheritdoc />
public string Mention => MentionUtils.MentionChannel(Id);

internal RestVoiceChannel(BaseDiscordClient discord, IGuild guild, ulong id)
: base(discord, guild, id)
{
@@ -60,7 +63,7 @@ namespace Discord.Rest
/// <inheritdoc />
public Task SyncPermissionsAsync(RequestOptions options = null)
=> ChannelHelper.SyncPermissionsAsync(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)


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

@@ -20,6 +20,7 @@ namespace Discord.WebSocket
public int Bitrate { get; private set; }
/// <inheritdoc />
public int? UserLimit { get; private set; }

/// <inheritdoc />
public ulong? CategoryId { get; private set; }
/// <summary>
@@ -30,6 +31,10 @@ namespace Discord.WebSocket
/// </returns>
public ICategoryChannel Category
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null;

/// <inheritdoc />
public string Mention => MentionUtils.MentionChannel(Id);

/// <inheritdoc />
public Task SyncPermissionsAsync(RequestOptions options = null)
=> ChannelHelper.SyncPermissionsAsync(this, Discord, options);


+ 2
- 0
test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs View File

@@ -12,6 +12,8 @@ namespace Discord

public int? UserLimit => throw new NotImplementedException();

public string Mention => throw new NotImplementedException();

public ulong? CategoryId => throw new NotImplementedException();

public int Position => throw new NotImplementedException();


Loading…
Cancel
Save