Skip to content

Commit

Permalink
wiki command default to home page
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxiao921 committed Sep 27, 2020
1 parent 9bc8780 commit 897ee71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 4 additions & 5 deletions CHEF/Components/Commands/Info.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public async Task ModInfo(
}
catch (JsonSerializationException)
{
await ReplyAsync("Couldn't retrieve mod information, Thunderstore API is probably down.");
await ReplyAsync(Thunderstore.IsDownMessage);
return;
}

Expand Down Expand Up @@ -218,22 +218,21 @@ public async Task ThunderstoreAPIInfo()
}
catch (JsonSerializationException)
{
await ReplyAsync("Couldn't retrieve mod information, Thunderstore API is probably down.");
await ReplyAsync(Thunderstore.IsDownMessage);
return;
}

if (modInfo != null)
{
await ReplyAsync("The Thunderstore API seems to be up.");
return;
await ReplyAsync(Thunderstore.IsUpMessage);
}
}

[Command("wiki")]
[Summary
("Returns info about wiki pages from the R2Wiki")]
public async Task WikiSearch(
[Remainder] string search)
[Remainder] string search = "Home")
{
search = search.Trim();
var encoded = WebUtility.UrlEncode(search);
Expand Down
3 changes: 3 additions & 0 deletions CHEF/Components/Commands/ThunderstoreAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public class VersionV1

public static class Thunderstore
{
public const string IsDownMessage = "Couldn't retrieve mod information, Thunderstore API is down. (Try again in 5-10 minutes)";
public const string IsUpMessage = "The Thunderstore API is up.";

public static async Task<PackageV1> GetModInfoV1(string modName)
{
using (var httpClient = new HttpClient())
Expand Down

0 comments on commit 897ee71

Please sign in to comment.