Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions DiscordBot/Modules/TipModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,27 @@ public async Task ListTips(params string[] keywords)
foreach (var tip in tips)
foreach (var term in tip.Keywords)
terms.Add(term);
var termList = string.Join("`, `", terms.OrderBy(k => k));
await ReplyAsync($"Total of {tips.Count} tips found, add one or more keywords to narrow the search.\n`{termList}`");
await ReplyAsync($"Total of {tips.Count} tips found, add one or more keywords to narrow the search.");
var termList = new List<string>();
foreach (var tip in terms.OrderBy(k => k))
termList.Add(tip);
floodCount = 150;
while (termList.Count > 0)
{
int count = termList.Count;
if (count > floodCount)
count = floodCount-10;
string keywordList = "Keywords: ";
for (int i = 0; i < count; i++)
{
keywordList += $"`{termList[0]}`, ";
termList.RemoveAt(0);
}
keywordList = keywordList.Substring(0, keywordList.Length-2);
await ReplyAsync(keywordList);
if (termList.Count > 0)
await Task.Delay(500);
}
return;
}
}
Expand Down
Loading