Skip to content

Commit 55f62ad

Browse files
committed
MessageBulker: backup correction for long messages
1 parent 272d770 commit 55f62ad

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

MessageBulker.cs

+11-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void DoSend()
113113
}
114114
catch (Exception ex)
115115
{
116-
Console.Error.WriteLine($"MessageBulker encountered error while sending message to channel {self.Channel.Id}: {ex}");
116+
Console.Error.WriteLine($"MessageBulker encountered error while sending message to channel {self.Channel.Id}:\nMessage: {output}\nException: {ex}");
117117
}
118118
});
119119
}
@@ -136,7 +136,16 @@ public void Send(string text)
136136
{
137137
lock (Internal.Locker)
138138
{
139-
Internal.ToSend.Enqueue(text);
139+
if (text.Length > 1990)
140+
{
141+
Internal.ToSend.Enqueue(text[..1950]);
142+
Send(text[1950..]);
143+
return;
144+
}
145+
else
146+
{
147+
Internal.ToSend.Enqueue(text);
148+
}
140149
if (!Internal.HasSendTaskActive && (Internal.LastSentTicks <= 0 || Internal.LastSentTicks + 1500 < Environment.TickCount64 || text.Length > 1800))
141150
{
142151
Internal.DoSend();

0 commit comments

Comments
 (0)