Browse Source

Merge branch 'release/3.x' of https://github.com/Discord-Net-Labs/Discord.Net-Labs into release/3.x

pull/1923/head
quin lynch 3 years ago
parent
commit
ddf7624d08
13 changed files with 53 additions and 131 deletions
  1. +1
    -1
      README.md
  2. +1
    -0
      azure-pipelines.yml
  3. +0
    -1
      src/Discord.Net.Commands/Discord.Net.Commands.csproj
  4. +0
    -3
      src/Discord.Net.Core/Discord.Net.Core.csproj
  5. +3
    -1
      src/Discord.Net.Core/Entities/Interactions/Slash Commands/SlashCommandBuilder.cs
  6. +0
    -3
      src/Discord.Net.Rest/Discord.Net.Rest.csproj
  7. +25
    -12
      src/Discord.Net.Rest/DiscordRestApiClient.cs
  8. +1
    -1
      src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs
  9. +0
    -27
      src/Discord.Net.WebSocket/Discord - Backup.Net.WebSocket.csproj
  10. +0
    -3
      src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj
  11. +14
    -42
      src/Discord.Net.WebSocket/Entities/Interaction/Message Components/SocketMessageComponent.cs
  12. +8
    -36
      src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs
  13. +0
    -1
      src/Discord.Net.Webhook/Discord.Net.Webhook.csproj

+ 1
- 1
README.md View File

@@ -1,5 +1,5 @@
# Discord.Net Labs
[![NuGet](https://img.shields.io/nuget/vpre/Discord.Net.Labs.svg?maxAge=2592000?style=plastic)](https://www.nuget.org/packages/Discord.Net.Labs)
[![NuGet](https://img.shields.io/nuget/vpre/Discord.Net.Labs.svg?maxAge=2592000&logo=nuget)](https://www.nuget.org/packages/Discord.Net.Labs)
[![Discord](https://discord.com/api/guilds/848176216011046962/widget.png)](https://discord.gg/dvSfUTet3K)

This repo is a custom fork of Discord.Net that introduces the newest features of discord for testing and experimenting. Nothing here is guaranteed to work but you are more than welcome to submit bugs in the issues tabs


+ 1
- 0
azure-pipelines.yml View File

@@ -2,6 +2,7 @@ variables:
buildConfiguration: Release
buildTag: $[ startsWith(variables['Build.SourceBranch'], 'refs/tags') ]
buildNumber: $[ variables['Build.BuildNumber'] ]
suffix: $(Date:yyyyMMdd)

trigger:
tags:


+ 0
- 1
src/Discord.Net.Commands/Discord.Net.Commands.csproj View File

@@ -7,7 +7,6 @@
<Description>A Discord.Net Labs extension adding support for bot commands.</Description>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>3.0.1</Version>
<PackageId>Discord.Net.Labs.Commands</PackageId>
<PackageProjectUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</PackageProjectUrl>
<RepositoryUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</RepositoryUrl>


+ 0
- 3
src/Discord.Net.Core/Discord.Net.Core.csproj View File

@@ -8,12 +8,9 @@
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0;netstandard2.1</TargetFrameworks>
<PackageId>Discord.Net.Labs.Core</PackageId>
<Version>3.1.1</Version>
<Product>Discord.Net.Labs.Core</Product>
<RepositoryUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</RepositoryUrl>
<PackageIcon>Temporary.png</PackageIcon>
<AssemblyVersion>3.1.1</AssemblyVersion>
<FileVersion>3.1.1</FileVersion>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup>


+ 3
- 1
src/Discord.Net.Core/Entities/Interactions/Slash Commands/SlashCommandBuilder.cs View File

@@ -50,7 +50,8 @@ namespace Discord
}

/// <summary>
/// A 1-100 length description of this slash command
/// A 1-100 length description of this slash command.
/// The description is not allowed to be null.
/// </summary>
public string Description
{
@@ -60,6 +61,7 @@ namespace Discord
}
set
{
Preconditions.NotNullOrEmpty(value, nameof(Description));
Preconditions.AtLeast(value.Length, 1, nameof(Description));
Preconditions.AtMost(value.Length, MaxDescriptionLength, nameof(Description));



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

@@ -9,11 +9,8 @@
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0;netstandard2.1</TargetFrameworks>
<PackageIcon>Temporary.png</PackageIcon>
<PackageProjectUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</PackageProjectUrl>
<Version>3.1.1</Version>
<PackageId>Discord.Net.Labs.Rest</PackageId>
<RepositoryUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</RepositoryUrl>
<AssemblyVersion>3.1.1</AssemblyVersion>
<FileVersion>3.1.1</FileVersion>
</PropertyGroup>
<PropertyGroup>
<DocumentationFile>..\Discord.Net.Rest\Discord.Net.Rest.xml</DocumentationFile>


+ 25
- 12
src/Discord.Net.Rest/DiscordRestApiClient.cs View File

@@ -320,6 +320,7 @@ namespace Discord.API
var model = await SendAsync<Channel>("GET", () => $"channels/{channelId}", ids, options: options).ConfigureAwait(false);
if (!model.GuildId.IsSpecified || model.GuildId.Value != guildId)
return null;

return model;
}
catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; }
@@ -338,11 +339,16 @@ namespace Discord.API
Preconditions.NotNull(args, nameof(args));
Preconditions.GreaterThan(args.Bitrate, 0, nameof(args.Bitrate));
Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
Preconditions.LessThan(args.Name.Length, 100, nameof(args.Name));
if (args.Topic.IsSpecified)
Preconditions.LessThan(args.Topic.Value.Length, 1024, nameof(args.Name));

options = RequestOptions.CreateOrClone(options);

var ids = new BucketIds(guildId: guildId);
return await SendJsonAsync<Channel>("POST", () => $"guilds/{guildId}/channels", args, ids, options: options).ConfigureAwait(false);
}

public async Task<Channel> DeleteChannelAsync(ulong channelId, RequestOptions options = null)
{
Preconditions.NotEqual(channelId, 0, nameof(channelId));
@@ -366,18 +372,23 @@ namespace Discord.API
Preconditions.NotEqual(channelId, 0, nameof(channelId));
Preconditions.NotNull(args, nameof(args));
Preconditions.AtLeast(args.Position, 0, nameof(args.Position));
Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name));
Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
Preconditions.LessThan(args.Name.Value.Length, 100, nameof(args.Name));

options = RequestOptions.CreateOrClone(options);

var ids = new BucketIds(channelId: channelId);
return await SendJsonAsync<Channel>("PATCH", () => $"channels/{channelId}", args, ids, options: options).ConfigureAwait(false);
}

public async Task<Channel> ModifyGuildChannelAsync(ulong channelId, Rest.ModifyTextChannelParams args, RequestOptions options = null)
{
Preconditions.NotEqual(channelId, 0, nameof(channelId));
Preconditions.NotNull(args, nameof(args));
Preconditions.AtLeast(args.Position, 0, nameof(args.Position));
Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name));
Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
Preconditions.LessThan(args.Name.Value.Length, 100, nameof(args.Name));
Preconditions.LessThan(args.Topic.Value.Length, 1024, nameof(args.Name));
Preconditions.AtLeast(args.SlowModeInterval, 0, nameof(args.SlowModeInterval));
Preconditions.AtMost(args.SlowModeInterval, 21600, nameof(args.SlowModeInterval));
options = RequestOptions.CreateOrClone(options);
@@ -385,6 +396,7 @@ namespace Discord.API
var ids = new BucketIds(channelId: channelId);
return await SendJsonAsync<Channel>("PATCH", () => $"channels/{channelId}", args, ids, options: options).ConfigureAwait(false);
}

public async Task<Channel> ModifyGuildChannelAsync(ulong channelId, Rest.ModifyVoiceChannelParams args, RequestOptions options = null)
{
Preconditions.NotEqual(channelId, 0, nameof(channelId));
@@ -392,12 +404,13 @@ namespace Discord.API
Preconditions.AtLeast(args.Bitrate, 8000, nameof(args.Bitrate));
Preconditions.AtLeast(args.UserLimit, 0, nameof(args.UserLimit));
Preconditions.AtLeast(args.Position, 0, nameof(args.Position));
Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name));
Preconditions.NotNullOrWhitespace(args.Name, nameof(args.Name));
options = RequestOptions.CreateOrClone(options);

var ids = new BucketIds(channelId: channelId);
return await SendJsonAsync<Channel>("PATCH", () => $"channels/{channelId}", args, ids, options: options).ConfigureAwait(false);
}

public async Task ModifyGuildChannelsAsync(ulong guildId, IEnumerable<Rest.ModifyGuildChannelsParams> args, RequestOptions options = null)
{
Preconditions.NotEqual(guildId, 0, nameof(guildId));
@@ -441,7 +454,7 @@ namespace Discord.API

return await SendJsonAsync<Channel>("POST", () => $"channels/{channelId}/messages/{messageId}/threads", args, bucket, options: options).ConfigureAwait(false);
}
public async Task<Channel> StartThreadAsync(ulong channelId, StartThreadParams args, RequestOptions options = null)
{
Preconditions.NotEqual(channelId, 0, nameof(channelId));
@@ -592,7 +605,7 @@ namespace Discord.API
#region Stage
public async Task<StageInstance> CreateStageInstanceAsync(CreateStageInstanceParams args, RequestOptions options = null)
{
options = RequestOptions.CreateOrClone(options);

var bucket = new BucketIds();
@@ -636,7 +649,7 @@ namespace Discord.API
{
return await SendAsync<StageInstance>("POST", () => $"stage-instances/{channelId}", bucket, options: options).ConfigureAwait(false);
}
catch(HttpException httpEx) when (httpEx.HttpCode == HttpStatusCode.NotFound)
catch (HttpException httpEx) when (httpEx.HttpCode == HttpStatusCode.NotFound)
{
return null;
}
@@ -1137,7 +1150,7 @@ namespace Discord.API
{
return await SendAsync<ApplicationCommand>("GET", () => $"applications/{CurrentUserId}/commands/{id}", new BucketIds(), options: options).ConfigureAwait(false);
}
catch(HttpException x) when (x.HttpCode == HttpStatusCode.NotFound) { return null; }
catch (HttpException x) when (x.HttpCode == HttpStatusCode.NotFound) { return null; }
}

public async Task<ApplicationCommand> CreateGlobalApplicationCommandAsync(CreateApplicationCommandParams command, RequestOptions options = null)
@@ -1208,7 +1221,7 @@ namespace Discord.API
{
return await SendAsync<ApplicationCommand>("GET", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/{commandId}", bucket, options: options);
}
catch(HttpException x) when (x.HttpCode == HttpStatusCode.NotFound) { return null; }
catch (HttpException x) when (x.HttpCode == HttpStatusCode.NotFound) { return null; }
}

public async Task<ApplicationCommand> CreateGuildApplicationCommandAsync(CreateApplicationCommandParams command, ulong guildId, RequestOptions options = null)
@@ -1236,7 +1249,7 @@ namespace Discord.API

var bucket = new BucketIds(guildId: guildId);

return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/{commandId}", command, bucket, options: options)).ConfigureAwait(false);
return await TrySendApplicationCommandAsync(SendJsonAsync<ApplicationCommand>("PATCH", () => $"applications/{CurrentUserId}/guilds/{guildId}/commands/{commandId}", command, bucket, options: options)).ConfigureAwait(false);
}
public async Task DeleteGuildApplicationCommandAsync(ulong guildId, ulong commandId, RequestOptions options = null)
{
@@ -1260,7 +1273,7 @@ namespace Discord.API
#region Interaction Responses
public async Task CreateInteractionResponseAsync(InteractionResponse response, ulong interactionId, string interactionToken, RequestOptions options = null)
{
if(response.Data.IsSpecified && response.Data.Value.Content.IsSpecified)
if (response.Data.IsSpecified && response.Data.Value.Content.IsSpecified)
Preconditions.AtMost(response.Data.Value.Content.Value?.Length ?? 0, 2000, nameof(response.Data.Value.Content));

options = RequestOptions.CreateOrClone(options);
@@ -1309,7 +1322,7 @@ namespace Discord.API
Preconditions.NotNull(args, nameof(args));
Preconditions.NotEqual(id, 0, nameof(id));

if(args.Content.IsSpecified)
if (args.Content.IsSpecified)
if (args.Content.Value.Length > DiscordConfig.MaxMessageSize)
throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));

@@ -2102,7 +2115,7 @@ namespace Discord.API
else
return result;
}
catch(HttpException x)
catch (HttpException x)
{
if (x.HttpCode == HttpStatusCode.BadRequest)
{


+ 1
- 1
src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs View File

@@ -195,7 +195,7 @@ namespace Discord.Rest
if (args.Name.IsSpecified)
{
Preconditions.AtMost(args.Name.Value.Length, 32, nameof(args.Name));
Preconditions.AtLeast(args.Name.Value.Length, 3, nameof(args.Name));
Preconditions.AtLeast(args.Name.Value.Length, 1, nameof(args.Name));
}

var model = new Discord.API.Rest.ModifyApplicationCommandParams()


+ 0
- 27
src/Discord.Net.WebSocket/Discord - Backup.Net.WebSocket.csproj View File

@@ -1,27 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Discord.Net.targets" />
<Import Project="../../StyleAnalyzer.targets" />
<PropertyGroup>
<AssemblyName>Discord.Net.WebSocket</AssemblyName>
<RootNamespace>Discord.WebSocket</RootNamespace>
<Description>A core Discord.Net Labs library containing the WebSocket client and models.</Description>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0;netstandard2.1</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>2.3.1</Version>
<RepositoryUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</RepositoryUrl>
<PackageProjectUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</PackageProjectUrl>
<PackageIcon>Temporary.png</PackageIcon>
<PackageId>Discord.Net.Labs.WebSocket</PackageId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Discord.Net.Core\Discord.Net.Core.csproj" />
<ProjectReference Include="..\Discord.Net.Rest\Discord.Net.Rest.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\..\..\..\Downloads\Temporary.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>

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

@@ -8,7 +8,6 @@
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0;netstandard2.1</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>3.1.1</Version>
<RepositoryUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</RepositoryUrl>
<PackageProjectUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</PackageProjectUrl>
<PackageIcon>Temporary.png</PackageIcon>
@@ -16,8 +15,6 @@
</PropertyGroup>
<PropertyGroup>
<DocumentationFile>..\Discord.Net.WebSocket\Discord.Net.WebSocket.xml</DocumentationFile>
<AssemblyVersion>3.1.1</AssemblyVersion>
<FileVersion>3.1.1</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE</DefineConstants>


+ 14
- 42
src/Discord.Net.WebSocket/Entities/Interaction/Message Components/SocketMessageComponent.cs View File

@@ -10,9 +10,9 @@ using System.IO;

namespace Discord.WebSocket
{
/// <summary>
/// Represents a Websocket-based interaction type for Message Components.
/// </summary>
/// <summary>
/// Represents a Websocket-based interaction type for Message Components.
/// </summary>
public class SocketMessageComponent : SocketInteraction
{
/// <summary>
@@ -84,16 +84,9 @@ namespace Discord.WebSocket
if (!IsValidToken)
throw new InvalidOperationException("Interaction token is no longer valid");

embeds ??= Array.Empty<Embed>();
if (embed != null)
{
if (embeds == null)
embeds = new[] { embed };
else
{
List<Embed> listEmbeds = embeds.ToList();
listEmbeds.Insert(0, embed);
}
}
embeds = new[] { embed }.Concat(embeds).ToArray();

Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed.");
@@ -150,9 +143,9 @@ namespace Discord.WebSocket

if (args.AllowedMentions.IsSpecified)
{
var allowedMentions = args.AllowedMentions.Value;
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions), "A max of 100 user Ids are allowed.");
var allowedMentions = args.AllowedMentions.Value;
Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions), "A max of 100 user Ids are allowed.");
}

var embed = args.Embed;
@@ -227,16 +220,9 @@ namespace Discord.WebSocket
if (!IsValidToken)
throw new InvalidOperationException("Interaction token is no longer valid");

embeds ??= Array.Empty<Embed>();
if (embed != null)
{
if (embeds == null)
embeds = new[] { embed };
else
{
List<Embed> listEmbeds = embeds.ToList();
listEmbeds.Insert(0, embed);
}
}
embeds = new[] { embed }.Concat(embeds).ToArray();

Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed.");
@@ -273,16 +259,9 @@ namespace Discord.WebSocket
if (!IsValidToken)
throw new InvalidOperationException("Interaction token is no longer valid");

embeds ??= Array.Empty<Embed>();
if (embed != null)
{
if (embeds == null)
embeds = new[] { embed };
else
{
List<Embed> listEmbeds = embeds.ToList();
listEmbeds.Insert(0, embed);
}
}
embeds = new[] { embed }.Concat(embeds).ToArray();

Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed.");
@@ -322,16 +301,9 @@ namespace Discord.WebSocket
if (!IsValidToken)
throw new InvalidOperationException("Interaction token is no longer valid");

embeds ??= Array.Empty<Embed>();
if (embed != null)
{
if (embeds == null)
embeds = new[] { embed };
else
{
List<Embed> listEmbeds = embeds.ToList();
listEmbeds.Insert(0, embed);
}
}
embeds = new[] { embed }.Concat(embeds).ToArray();

Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed.");


+ 8
- 36
src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs View File

@@ -79,16 +79,9 @@ namespace Discord.WebSocket
if (!IsValidToken)
throw new InvalidOperationException("Interaction token is no longer valid");

embeds ??= Array.Empty<Embed>();
if (embed != null)
{
if (embeds == null)
embeds = new[] { embed };
else
{
List<Embed> listEmbeds = embeds.ToList();
listEmbeds.Insert(0, embed);
}
}
embeds = new[] { embed }.Concat(embeds).ToArray();

Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed.");
@@ -141,16 +134,9 @@ namespace Discord.WebSocket
if (!IsValidToken)
throw new InvalidOperationException("Interaction token is no longer valid");

embeds ??= Array.Empty<Embed>();
if (embed != null)
{
if (embeds == null)
embeds = new[] { embed };
else
{
List<Embed> listEmbeds = embeds.ToList();
listEmbeds.Insert(0, embed);
}
}
embeds = new[] { embed }.Concat(embeds).ToArray();

Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed.");
@@ -187,16 +173,9 @@ namespace Discord.WebSocket
if (!IsValidToken)
throw new InvalidOperationException("Interaction token is no longer valid");

embeds ??= Array.Empty<Embed>();
if (embed != null)
{
if (embeds == null)
embeds = new[] { embed };
else
{
List<Embed> listEmbeds = embeds.ToList();
listEmbeds.Insert(0, embed);
}
}
embeds = new[] { embed }.Concat(embeds).ToArray();

Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed.");
@@ -236,16 +215,9 @@ namespace Discord.WebSocket
if (!IsValidToken)
throw new InvalidOperationException("Interaction token is no longer valid");

embeds ??= Array.Empty<Embed>();
if (embed != null)
{
if (embeds == null)
embeds = new[] { embed };
else
{
List<Embed> listEmbeds = embeds.ToList();
listEmbeds.Insert(0, embed);
}
}
embeds = new[] { embed }.Concat(embeds).ToArray();

Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed.");
Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed.");


+ 0
- 1
src/Discord.Net.Webhook/Discord.Net.Webhook.csproj View File

@@ -6,7 +6,6 @@
<RootNamespace>Discord.Webhook</RootNamespace>
<Description>A core Discord.Net Labs library containing the Webhook client and models.</Description>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>3.0.0</Version>
<PackageId>Discord.Net.Labs.Webhook</PackageId>
<PackageProjectUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</PackageProjectUrl>
<RepositoryUrl>https://github.com/Discord-Net-Labs/Discord.Net-Labs</RepositoryUrl>


Loading…
Cancel
Save