bugfixed
This commit is contained in:
parent
219380faf9
commit
03a7a3adf6
@ -113,7 +113,7 @@ namespace NadekoBot.Modules.Searches
|
||||
}
|
||||
sb.AppendLine("```");
|
||||
}
|
||||
await msg.ReplyLong(sb.ToString(),addToPartialStart : "```xl\n",addToPartialEnd: "```", breakOn: new[] { "```xl\n", "\n" });
|
||||
await msg.ReplyLong(sb.ToString(), breakOn: new[] { "```xl", "\n" });
|
||||
}
|
||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
@ -127,7 +127,7 @@ namespace NadekoBot.Modules.Searches
|
||||
sb.AppendLine(string.Join(",", group.Select(x => x.Triggers.FirstOrDefault()).OrderBy(x => x)));
|
||||
sb.AppendLine("```");
|
||||
}
|
||||
await msg.ReplyLong(sb.ToString(), addToPartialStart: "```xl\n", addToPartialEnd: "```", breakOn: new[] { "```xl\n", "\n" });
|
||||
await msg.ReplyLong(sb.ToString(), breakOn: new[] { "```xl\n", "\n" });
|
||||
}
|
||||
[LocalizedCommand, LocalizedDescription, LocalizedSummary, LocalizedAlias]
|
||||
public async Task Convert(IUserMessage msg, string origin, string target, decimal value)
|
||||
|
@ -54,17 +54,16 @@ namespace NadekoBot.Extensions
|
||||
{
|
||||
if (splitItems.Count == 0)
|
||||
{
|
||||
splitItems = content.Split(new[] { breaker }, StringSplitOptions.RemoveEmptyEntries).Select(x => x += breaker).ToList();
|
||||
splitItems = Regex.Split(content, $"(?={breaker})").Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < splitItems.Count; i++)
|
||||
{
|
||||
|
||||
var temp = splitItems[i];
|
||||
if (temp.Length > characterLimit)
|
||||
{
|
||||
var splitDeep = temp.Split(new[] { breaker }, StringSplitOptions.RemoveEmptyEntries).Select(x => x += breaker);
|
||||
var splitDeep = Regex.Split(temp, $"(?={breaker})").Where(s => !string.IsNullOrWhiteSpace(s));
|
||||
splitItems.RemoveAt(i);
|
||||
splitItems.InsertRange(i, splitDeep);
|
||||
}
|
||||
@ -79,7 +78,7 @@ namespace NadekoBot.Extensions
|
||||
}
|
||||
//ensured every item can be sent (if individually)
|
||||
var firstItem = true;
|
||||
Queue<string> buildItems = new Queue<string>();
|
||||
Queue<string> buildItems = new Queue<string>(splitItems);
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
while (buildItems.Count > 0)
|
||||
@ -92,7 +91,8 @@ namespace NadekoBot.Extensions
|
||||
else
|
||||
firstItem = false;
|
||||
builder.Append(buildItems.Dequeue());
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Append(buildItems.Dequeue());
|
||||
}
|
||||
@ -100,7 +100,8 @@ namespace NadekoBot.Extensions
|
||||
{
|
||||
list.Add(await msg.Channel.SendMessageAsync(builder.ToString()));
|
||||
builder.Clear();
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
var peeked = buildItems.Peek();
|
||||
if (builder.Length + peeked.Length + addToPartialEnd.Length > characterLimit)
|
||||
|
Loading…
Reference in New Issue
Block a user