feat(bot): correctly proxy voice messages
This commit is contained in:
@@ -121,7 +121,7 @@ public class ImportExport
|
||||
|
||||
var msg = await ctx.Rest.CreateMessage(dm,
|
||||
new MessageRequest { Content = $"{Emojis.Success} Here you go!" },
|
||||
new[] { new MultipartFile("system.json", stream, null) });
|
||||
new[] { new MultipartFile("system.json", stream, null, null, null) });
|
||||
await ctx.Rest.CreateMessage(dm, new MessageRequest { Content = $"<{msg.Attachments[0].Url}>" });
|
||||
|
||||
// If the original message wasn't posted in DMs, send a public reminder
|
||||
|
||||
@@ -285,7 +285,7 @@ public class ProxiedMessage
|
||||
{
|
||||
Content = $"{Emojis.Warn} Message contains codeblocks, raw source sent as an attachment."
|
||||
},
|
||||
new[] { new MultipartFile("message.txt", stream, null) });
|
||||
new[] { new MultipartFile("message.txt", stream, null, null, null) });
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -562,7 +562,7 @@ public class SystemEdit
|
||||
var dm = await _dmCache.GetOrCreateDmChannel(ctx.Author.Id);
|
||||
var msg = await ctx.Rest.CreateMessage(dm,
|
||||
new MessageRequest { Content = $"{Emojis.Success} System deleted. If you want to set up your PluralKit system again, you can import the file below with `pk;import`." },
|
||||
new[] { new MultipartFile("system.json", stream, null) });
|
||||
new[] { new MultipartFile("system.json", stream, null, null, null) });
|
||||
await ctx.Rest.CreateMessage(dm, new MessageRequest { Content = $"<{msg.Attachments[0].Url}>" });
|
||||
|
||||
// If the original message wasn't posted in DMs, send a public reminder
|
||||
|
||||
@@ -217,7 +217,8 @@ public class ProxyService
|
||||
FileSizeLimit = guild.FileSizeLimit(),
|
||||
Embeds = embeds.ToArray(),
|
||||
Stickers = trigger.StickerItems,
|
||||
AllowEveryone = allowEveryone
|
||||
AllowEveryone = allowEveryone,
|
||||
Flags = trigger.Flags.HasFlag(Message.MessageFlags.VoiceMessage) ? Message.MessageFlags.VoiceMessage : null,
|
||||
});
|
||||
await HandleProxyExecutedActions(ctx, autoproxySettings, trigger, proxyMessage, match);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public record ProxyRequest
|
||||
public Embed[] Embeds { get; init; }
|
||||
public Sticker[] Stickers { get; init; }
|
||||
public bool AllowEveryone { get; init; }
|
||||
public Message.MessageFlags? Flags { get; init; }
|
||||
}
|
||||
|
||||
public class WebhookExecutorService
|
||||
@@ -129,6 +130,7 @@ public class WebhookExecutorService
|
||||
AvatarUrl = !string.IsNullOrWhiteSpace(req.AvatarUrl) ? req.AvatarUrl : null,
|
||||
Embeds = req.Embeds,
|
||||
Stickers = req.Stickers,
|
||||
Flags = req.Flags,
|
||||
};
|
||||
|
||||
MultipartFile[] files = null;
|
||||
@@ -144,7 +146,9 @@ public class WebhookExecutorService
|
||||
{
|
||||
Id = (ulong)Array.IndexOf(files, f),
|
||||
Description = f.Description,
|
||||
Filename = f.Filename
|
||||
Filename = f.Filename,
|
||||
Waveform = f.Waveform,
|
||||
DurationSecs = f.DurationSecs
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
@@ -226,7 +230,8 @@ public class WebhookExecutorService
|
||||
{
|
||||
Id = (ulong)Array.IndexOf(files, f),
|
||||
Description = f.Description,
|
||||
Filename = f.Filename
|
||||
Filename = f.Filename,
|
||||
Waveform = f.Waveform
|
||||
}).ToArray()
|
||||
};
|
||||
await _rest.ExecuteWebhook(webhook.Id, webhook.Token!, req, files, threadId);
|
||||
@@ -240,7 +245,7 @@ public class WebhookExecutorService
|
||||
var attachmentResponse =
|
||||
await _client.GetAsync(attachment.Url, HttpCompletionOption.ResponseHeadersRead);
|
||||
return new MultipartFile(attachment.Filename, await attachmentResponse.Content.ReadAsStreamAsync(),
|
||||
attachment.Description);
|
||||
attachment.Description, attachment.Waveform, attachment.DurationSecs);
|
||||
}
|
||||
|
||||
return await Task.WhenAll(attachments.Select(GetStream));
|
||||
|
||||
Reference in New Issue
Block a user