Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove &,# and * from keywords #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions Vita3KBot/Commands/Compatibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public async Task Compatability([Remainder, Summary("Game name to search")]strin
State = ItemState.Open,
};

var keywords = keyword.ToLower().Split(' ');
var keywords = keyword.ToLower().Replace("&", " ").Replace("#", " ").Split(' ');
var searchResults = (await github.Search.SearchIssues(search)).Items;
// The following makes sure all the keywords are contained in each title, and removes the ones that don't.
var filteredResults = searchResults.Where(
Expand All @@ -123,7 +123,7 @@ public async Task Compatability([Remainder, Summary("Game name to search")]strin
var info = new TitleInfo(issue);
await info.FetchCommentInfo(github);
var builder = new EmbedBuilder()
.WithTitle("*" + issue.Title + "* (" + (info.IsHomebrew ? "Homebrew" : "Commercial") + ")")
.WithTitle("*" + issue.Title.Replace("*", "\\*") + "* (" + (info.IsHomebrew ? "Homebrew" : "Commercial") + ")")
.WithDescription("Status: **" + info.Status + "**\n\n" + info.LatestComment)
.WithColor(info.LabelColor)
.WithUrl(issue.HtmlUrl)
Expand All @@ -140,7 +140,7 @@ public async Task Compatability([Remainder, Summary("Game name to search")]strin
var issue = filteredResults[a];
var info = new TitleInfo(issue);
var homebrewText = info.IsHomebrew ? "Homebrew" : "Commercial";
description.Append($"*[{issue.Title}]({issue.HtmlUrl})* ({homebrewText}): **{info.Status}**\n");
description.Append($"*[{issue.Title.Replace("*", "\\*")}]({issue.HtmlUrl})* ({homebrewText}): **{info.Status}**\n");
}
if (filteredResults.Count > MaxItemsToDisplay) description.Append("...");

Expand Down