2
0
mirror of synced 2025-01-12 17:44:08 +00:00

Fixes message length issue for admin-channel messages.

This commit is contained in:
Ben 2024-10-22 13:55:52 +02:00
parent 292b4b9b06
commit 5c65d1d74e
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B

View File

@ -1,5 +1,7 @@
using Discord;
using BiblioTech.Options;
using Discord;
using Discord.WebSocket;
using Org.BouncyCastle.Utilities;
namespace BiblioTech
{
@ -29,7 +31,19 @@ namespace BiblioTech
public async Task SendInAdminChannel(string msg)
{
await adminChannel.SendMessageAsync(msg);
await SendInAdminChannel(msg.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries));
}
public async Task SendInAdminChannel(string[] lines)
{
var chunker = new LineChunker(lines);
var chunks = chunker.GetChunks();
if (!chunks.Any()) return;
foreach (var chunk in chunks)
{
await adminChannel.SendMessageAsync(string.Join(Environment.NewLine, chunk));
}
}
public void SetAdminChannel(ISocketMessageChannel adminChannel)