Slackord icon indicating copy to clipboard operation
Slackord copied to clipboard

Cannot import long messages (over 2000 characters)

Open aplex opened this issue 2 years ago • 1 comments

Currently the import process breaks down with an exception like this:

Gateway A SlashCommandExecuted handler has thrown an unhandled exception.: System.ArgumentException: Message content is too long, length must be less or equal to 2000. (Parameter 'Content') at Discord.API.DiscordRestApiClient.CreateMessageAsync(UInt64 channelId, CreateMessageParams args, RequestOptions options) at Discord.Rest.ChannelHelper.SendMessageAsync(IMessageChannel channel, BaseDiscordClient client, String text, Boolean isTTS, Embed embed, AllowedMentions allowedMentions, MessageReference messageReference, MessageComponent components, ISticker[] stickers, RequestOptions options, Embed[] embeds, MessageFlags flags) at Slackord.Slackord.PostMessages(SocketChannel channel, UInt64 guildID) in Z:\Development\Git Repositories\Slackord2\Slackord_Win\Slackord\Slackord.cs:line 477

The message itself has 2500 text length, file attachment and a dozen of blocks that reference youtube videos

It would be good to truncate/skip/split such messages automatically.

I'm using v2.2.5.2

aplex avatar Sep 11 '22 00:09 aplex

The message should have been split up, as this functionality is already included. Would you be willing to shoot me the JSON file for testing so I can hotfix this? You can Google Drive it, or any other preferred method you wish and feel comfortable with, then shoot me a DM on Twitter with the link.

thomasloupe avatar Sep 11 '22 00:09 thomasloupe

This bug should be fixed in https://github.com/thomasloupe/Slackord2/releases/tag/v2.4! Please feel free to re-open this issue if you encounter it again.

thomasloupe avatar Nov 06 '22 01:11 thomasloupe

Hi there,

I still experienced this issue with version 2.4.3.5 for Mac. I solved this issue by recompiling Slackord after adding messageToSend = response + " " + "\n"; to the foreach (var response in responses) loop in Program.cs. The resulting code snippet looks like this:

foreach (var response in responses)
{
    messageToSend = response + " " + "\n";
    if (sendAsThread)

I took the messageToSend one-liner from the Windows version, so I believe it may have simply been forgotten in the Mac_Linux version.

Best wishes, Philippe

pjawinski avatar Feb 06 '23 19:02 pjawinski

Oops! Sorry about that. It's very likely I did forget. I'll patch this and get a hotfix in sometime this week. Thanks for the report!

thomasloupe avatar Feb 06 '23 20:02 thomasloupe

Fixed in https://github.com/thomasloupe/Slackord2/releases/tag/v2.4.3.6.

Thanks again for the report!

thomasloupe avatar Feb 08 '23 11:02 thomasloupe