Skip to content

Commit

Permalink
Escape special symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
nishinji committed Feb 17, 2024
1 parent e51b13f commit 6f17644
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 6f17644

Please sign in to comment.