Fixes message length issue for admin-channel messages.
This commit is contained in:
parent
292b4b9b06
commit
5c65d1d74e
@ -1,5 +1,7 @@
|
|||||||
using Discord;
|
using BiblioTech.Options;
|
||||||
|
using Discord;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
using Org.BouncyCastle.Utilities;
|
||||||
|
|
||||||
namespace BiblioTech
|
namespace BiblioTech
|
||||||
{
|
{
|
||||||
@ -29,7 +31,19 @@ namespace BiblioTech
|
|||||||
|
|
||||||
public async Task SendInAdminChannel(string msg)
|
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)
|
public void SetAdminChannel(ISocketMessageChannel adminChannel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user