Skip to content

Commit

Permalink
fix: remove useless return value & fix audit log nre
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Sep 2, 2024
1 parent cbeea44 commit ad831a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions DisCatSharp.Experimental/AudioHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public static (Stream Stream, byte[] Waveform) GenerateWaveformBytes(this Stream
/// </summary>
/// <param name="opusStream">The audio stream.</param>
/// <returns>The generated data.</returns>
public static (Stream Stream, float DurationSeconds, byte[] Waveform) GetDurationAndWaveformBytes(this Stream opusStream)
public static (float DurationSeconds, byte[] Waveform) GetDurationAndWaveformBytes(this Stream opusStream)
{
var (durationStream, duration) = GetOpusAudioDurationInSeconds(opusStream);
var (waveStream, waveform) = GenerateWaveformBytes(durationStream);
var (_, waveform) = GenerateWaveformBytes(durationStream);

return (waveStream, duration, waveform);
return (duration, waveform);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static DiscordMessageBuilder AddGcpAttachment(this DiscordMessageBuilder
else
{
ArgumentNullException.ThrowIfNull(originalStream, nameof(originalStream));
var (_, durationSeconds, waveform) = originalStream.GetDurationAndWaveformBytes();
var (durationSeconds, waveform) = originalStream.GetDurationAndWaveformBytes();
Console.WriteLine($"Waveform length: {waveform.Length} bytes");
builder.AttachmentsInternal.Add(new()
{
Expand Down Expand Up @@ -66,7 +66,7 @@ public static DiscordInteractionResponseBuilder AddGcpAttachment(this DiscordInt
else
{
ArgumentNullException.ThrowIfNull(originalStream, nameof(originalStream));
var (_, durationSeconds, waveform) = originalStream.GetDurationAndWaveformBytes();
var (durationSeconds, waveform) = originalStream.GetDurationAndWaveformBytes();
Console.WriteLine($"Waveform length: {waveform.Length} bytes");
builder.AttachmentsInternal.Add(new()
{
Expand Down Expand Up @@ -102,7 +102,7 @@ public static DiscordWebhookBuilder AddGcpAttachment(this DiscordWebhookBuilder
else
{
ArgumentNullException.ThrowIfNull(originalStream, nameof(originalStream));
var (_, durationSeconds, waveform) = originalStream.GetDurationAndWaveformBytes();
var (durationSeconds, waveform) = originalStream.GetDurationAndWaveformBytes();
builder.AttachmentsInternal.Add(new()
{
Filename = gcpAttachment.Filename,
Expand Down Expand Up @@ -137,7 +137,7 @@ public static DiscordFollowupMessageBuilder AddGcpAttachment(this DiscordFollowu
else
{
ArgumentNullException.ThrowIfNull(originalStream, nameof(originalStream));
var (_, durationSeconds, waveform) = originalStream.GetDurationAndWaveformBytes();
var (durationSeconds, waveform) = originalStream.GetDurationAndWaveformBytes();
builder.AttachmentsInternal.Add(new()
{
Filename = gcpAttachment.Filename,
Expand Down
2 changes: 1 addition & 1 deletion DisCatSharp/Entities/Guild/DiscordGuild.AuditLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ PropertyChange<DiscordChannel> GetChannelChange()
case AuditLogActionType.WebhookUpdate:
entry = new DiscordAuditLogWebhookEntry
{
Target = ahd.TryGetValue(xac.TargetId.Value, out var webhook)
Target = ahd?.TryGetValue(xac.TargetId.Value, out var webhook) ?? false
? webhook
: new()
{
Expand Down

0 comments on commit ad831a0

Please sign in to comment.