Browse Source

Conditional-expression-simplification (#193)

pull/1923/head
Simon Hjorthøj GitHub 3 years ago
parent
commit
a8ffa5d02c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 16 deletions
  1. +4
    -2
      src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs
  2. +6
    -5
      src/Discord.Net.Rest/API/Rest/CreateStickerParams.cs
  3. +4
    -3
      src/Discord.Net.Rest/API/Rest/CreateWebhookMessageParams.cs
  4. +1
    -1
      src/Discord.Net.Rest/Extensions/EntityExtensions.cs
  5. +1
    -1
      src/Discord.Net.Rest/Net/Queue/RequestQueueBucket.cs
  6. +1
    -1
      src/Discord.Net.WebSocket/DiscordSocketClient.cs
  7. +1
    -3
      src/Discord.Net.WebSocket/Entities/Stickers/SocketSticker.cs

+ 4
- 2
src/Discord.Net.Core/Entities/Interactions/Message Components/ComponentBuilder.cs View File

@@ -207,8 +207,10 @@ namespace Discord

if (_actionRows == null)
{
_actionRows = new List<ActionRowBuilder>();
_actionRows.Add(new ActionRowBuilder().AddComponent(builtButton));
_actionRows = new List<ActionRowBuilder>
{
new ActionRowBuilder().AddComponent(builtButton)
};
}
else
{


+ 6
- 5
src/Discord.Net.Rest/API/Rest/CreateStickerParams.cs View File

@@ -19,11 +19,12 @@ namespace Discord.API.Rest

public IReadOnlyDictionary<string, object> ToDictionary()
{
var d = new Dictionary<string, object>();

d["name"] = $"{Name}";
d["description"] = Description;
d["tags"] = Tags;
var d = new Dictionary<string, object>
{
["name"] = $"{Name}",
["description"] = Description,
["tags"] = Tags
};

string contentType = "image/png";



+ 4
- 3
src/Discord.Net.Rest/API/Rest/CreateWebhookMessageParams.cs View File

@@ -51,9 +51,10 @@ namespace Discord.API.Rest
d["file"] = File.Value;
}

var payload = new Dictionary<string, object>();

payload["content"] = Content;
var payload = new Dictionary<string, object>
{
["content"] = Content
};

if (IsTTS.IsSpecified)
payload["tts"] = IsTTS.Value.ToString();


+ 1
- 1
src/Discord.Net.Rest/Extensions/EntityExtensions.cs View File

@@ -39,7 +39,7 @@ namespace Discord.Rest
return new RoleTags(
model.BotId.IsSpecified ? model.BotId.Value : null,
model.IntegrationId.IsSpecified ? model.IntegrationId.Value : null,
model.IsPremiumSubscriber.IsSpecified ? true : false);
model.IsPremiumSubscriber.IsSpecified);
}
public static API.Embed ToModel(this Embed entity)
{


+ 1
- 1
src/Discord.Net.Rest/Net/Queue/RequestQueueBucket.cs View File

@@ -377,7 +377,7 @@ namespace Discord.Net.Queue
Debug.WriteLine($"[{id}] Retry-After: {info.RetryAfter.Value} ({info.RetryAfter.Value} ms)");
#endif
}
else if (info.ResetAfter.HasValue && (request.Options.UseSystemClock.HasValue ? !request.Options.UseSystemClock.Value : false))
else if (info.ResetAfter.HasValue && (request.Options.UseSystemClock.HasValue && !request.Options.UseSystemClock.Value))
{
resetTick = DateTimeOffset.UtcNow.Add(info.ResetAfter.Value);
#if DEBUG_LIMITS


+ 1
- 1
src/Discord.Net.WebSocket/DiscordSocketClient.cs View File

@@ -2453,7 +2453,7 @@ namespace Discord.WebSocket

SocketStageChannel before = type == "STAGE_INSTANCE_UPDATE" ? stageChannel.Clone() : null;

stageChannel.Update(data, type == "STAGE_INSTANCE_CREATE" ? true : type == "STAGE_INSTANCE_DELETE" ? false : false);
stageChannel.Update(data, type == "STAGE_INSTANCE_CREATE");

switch (type)
{


+ 1
- 3
src/Discord.Net.WebSocket/Entities/Stickers/SocketSticker.cs View File

@@ -95,9 +95,7 @@ namespace Discord.WebSocket
stickerModel.Type == this.Type &&
stickerModel.SortValue == this.SortOrder &&
stickerModel.Available == this.Available &&
(stickerModel.Tags.IsSpecified ?
stickerModel.Tags.Value == string.Join(", ", this.Tags) :
true);
(!stickerModel.Tags.IsSpecified || stickerModel.Tags.Value == string.Join(", ", this.Tags));
}
else
return base.Equals(obj);


Loading…
Cancel
Save