Browse Source

Made IVoiceChannel mentionable

pull/1923/head
quin lynch 4 years ago
parent
commit
d0738d67a1
8 changed files with 18 additions and 9 deletions
  1. +2
    -2
      src/Discord.Net.Core/Discord.Net.Core.xml
  2. +1
    -1
      src/Discord.Net.Core/Entities/Channels/IVoiceChannel.cs
  3. +4
    -4
      src/Discord.Net.Core/Entities/Interactions/Slash Commands/SlashCommandBuilder.cs
  4. +3
    -0
      src/Discord.Net.Rest/Discord.Net.Rest.xml
  5. +2
    -1
      src/Discord.Net.Rest/Entities/Channels/RestVoiceChannel.cs
  6. +3
    -0
      src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml
  7. +2
    -0
      src/Discord.Net.WebSocket/Entities/Channels/SocketVoiceChannel.cs
  8. +1
    -1
      test/Discord.Net.Tests.Unit/MockedEntities/MockedVoiceChannel.cs

+ 2
- 2
src/Discord.Net.Core/Discord.Net.Core.xml View File

@@ -6011,7 +6011,7 @@
<param name="value">The default permission value to set.</param>
<returns>The current builder.</returns>
</member>
<member name="M:Discord.SlashCommandBuilder.AddOption(System.String,Discord.ApplicationCommandOptionType,System.String,System.Boolean,System.Boolean,System.Boolean,System.Collections.Generic.List{Discord.SlashCommandOptionBuilder},Discord.ApplicationCommandOptionChoiceProperties[])">
<member name="M:Discord.SlashCommandBuilder.AddOption(System.String,Discord.ApplicationCommandOptionType,System.String,System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Boolean,System.Collections.Generic.List{Discord.SlashCommandOptionBuilder},Discord.ApplicationCommandOptionChoiceProperties[])">
<summary>
Adds an option to the current slash command.
</summary>
@@ -6108,7 +6108,7 @@
</summary>
<returns>The built version of this option.</returns>
</member>
<member name="M:Discord.SlashCommandOptionBuilder.AddOption(System.String,Discord.ApplicationCommandOptionType,System.String,System.Boolean,System.Boolean,System.Collections.Generic.List{Discord.SlashCommandOptionBuilder},Discord.ApplicationCommandOptionChoiceProperties[])">
<member name="M:Discord.SlashCommandOptionBuilder.AddOption(System.String,Discord.ApplicationCommandOptionType,System.String,System.Nullable{System.Boolean},System.Boolean,System.Collections.Generic.List{Discord.SlashCommandOptionBuilder},Discord.ApplicationCommandOptionChoiceProperties[])">
<summary>
Adds an option to the current slash command.
</summary>


+ 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
- 4
src/Discord.Net.Core/Entities/Interactions/Slash Commands/SlashCommandBuilder.cs View File

@@ -165,7 +165,7 @@ namespace Discord
/// <param name="choices">The choices of this option.</param>
/// <returns>The current builder.</returns>
public SlashCommandBuilder AddOption(string name, ApplicationCommandOptionType type,
string description, bool required = true, bool isDefault = false, bool isAutocomplete = false, List<SlashCommandOptionBuilder> options = null, params ApplicationCommandOptionChoiceProperties[] choices)
string description, bool? required = null, bool? isDefault = null, bool isAutocomplete = false, List<SlashCommandOptionBuilder> options = null, params ApplicationCommandOptionChoiceProperties[] choices)
{
// Make sure the name matches the requirements from discord
Preconditions.NotNullOrEmpty(name, nameof(name));
@@ -183,7 +183,7 @@ namespace Discord
Preconditions.AtMost(description.Length, MaxDescriptionLength, nameof(description));

// make sure theres only one option with default set to true
if (isDefault)
if (isDefault.HasValue && isDefault.Value)
{
if (this.Options != null)
if (this.Options.Any(x => x.Default.HasValue && x.Default.Value))
@@ -339,7 +339,7 @@ namespace Discord
/// <summary>
/// Gets or sets if the option is required.
/// </summary>
public bool Required { get; set; }
public bool? Required { get; set; } = null;

/// <summary>
/// Gets or sets whether or not this option supports autocomplete.
@@ -395,7 +395,7 @@ namespace Discord
/// <param name="choices">The choices of this option.</param>
/// <returns>The current builder.</returns>
public SlashCommandOptionBuilder AddOption(string name, ApplicationCommandOptionType type,
string description, bool required = true, bool isDefault = false, List<SlashCommandOptionBuilder> options = null, params ApplicationCommandOptionChoiceProperties[] choices)
string description, bool? required = null, bool isDefault = false, List<SlashCommandOptionBuilder> options = null, params ApplicationCommandOptionChoiceProperties[] choices)
{
// Make sure the name matches the requirements from discord
Preconditions.NotNullOrEmpty(name, nameof(name));


+ 3
- 0
src/Discord.Net.Rest/Discord.Net.Rest.xml View File

@@ -2803,6 +2803,9 @@
<member name="P:Discord.Rest.RestVoiceChannel.CategoryId">
<inheritdoc />
</member>
<member name="P:Discord.Rest.RestVoiceChannel.Mention">
<inheritdoc />
</member>
<member name="M:Discord.Rest.RestVoiceChannel.Update(Discord.API.Channel)">
<inheritdoc />
</member>


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

@@ -21,7 +21,8 @@ namespace Discord.Rest
public int? UserLimit { get; private set; }
/// <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)
{


+ 3
- 0
src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml View File

@@ -2802,6 +2802,9 @@
A category channel representing the parent of this channel; <c>null</c> if none is set.
</returns>
</member>
<member name="P:Discord.WebSocket.SocketVoiceChannel.Mention">
<inheritdoc />
</member>
<member name="M:Discord.WebSocket.SocketVoiceChannel.SyncPermissionsAsync(Discord.RequestOptions)">
<inheritdoc />
</member>


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

@@ -32,6 +32,8 @@ namespace Discord.WebSocket
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);



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

@@ -25,7 +25,7 @@ namespace Discord
public string Name => throw new NotImplementedException();

public DateTimeOffset CreatedAt => throw new NotImplementedException();
public string Mention => throw new NotImplementedException();
public ulong Id => throw new NotImplementedException();

public Task AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options = null)


Loading…
Cancel
Save