Skip to content

Commit

Permalink
Update repo location
Browse files Browse the repository at this point in the history
  • Loading branch information
SubZero0 committed Jan 29, 2019
1 parent 5b8ae2f commit 18d7488
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/DiscordNet/DiscordNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public async Task RunAsync()
Task.Run(async () =>
{
CancellationTokenSource cts = new CancellationTokenSource();
Func<Task> ctsTask = () =>
Task ctsTask()
{
cts.Cancel();
return Task.CompletedTask;
};
}

_client.Connected += ctsTask;
await Task.Delay(30000, cts.Token);
Expand Down
2 changes: 1 addition & 1 deletion src/DiscordNet/Modules/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public async Task Guides([Remainder] string guide = null)
string html;
using (var httpClient = new HttpClient())
{
var res = await httpClient.GetAsync("https://raw.githubusercontent.com/RogueException/Discord.Net/dev/docs/guides/toc.yml");
var res = await httpClient.GetAsync("https://raw.githubusercontent.com/discord-net/Discord.Net/dev/docs/guides/toc.yml");
if (!res.IsSuccessStatusCode)
throw new Exception($"An error occurred: {res.ReasonPhrase}");
html = await res.Content.ReadAsStringAsync();
Expand Down
1 change: 1 addition & 0 deletions src/DiscordNet/Query/Results/DocsHttpResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public class DocsHttpResult
public string Url { get; private set; }
public string Summary { get; private set; }
public string Example { get; private set; }

public DocsHttpResult(string url, string summary = null, string example = null)
{
Url = url;
Expand Down
6 changes: 3 additions & 3 deletions src/DiscordNet/Rest/Github/GithubRest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ private async Task<JObject> SendRequestAsync(HttpMethod method, string endpoint,

public async Task<IEnumerable<string>> GetIssuesUrlsAsync(IEnumerable<string> numbers)
{
var result = await Task.WhenAll(numbers.Select(x => SendRequestAsync(HttpMethod.Get, "/repos/RogueException/Discord.Net/issues/", x)));
var result = await Task.WhenAll(numbers.Select(x => SendRequestAsync(HttpMethod.Get, "/repos/discord-net/Discord.Net/issues/", x)));
return result.Select(x => (string)x["html_url"]);
}

public async Task<List<GitSearchResult>> SearchAsync(string search, string filename = null)
{
var extra = $"?q=repo:RogueException/Discord.Net+language:cs+in:file{(filename == null ? "" : $"+filename:{filename}")}+{search.Replace(' ', '+')}&per_page=100";
var extra = $"?q=repo:discord-net/Discord.Net+language:cs+in:file{(filename == null ? "" : $"+filename:{filename}")}+{search.Replace(' ', '+')}&per_page=100";
var result = await SendRequestAsync(HttpMethod.Get, "/search/code", extra);
var items = (JArray)result["items"];
var list = new List<GitSearchResult>();
Expand All @@ -57,7 +57,7 @@ public async Task<List<GitSearchResult>> SearchAsync(string search, string filen
int pages = (int)Math.Floor(totalCount / 100f);
for (int i = 2; i <= pages + 1; i++)
{
extra = $"?q=repo:RogueException/Discord.Net+language:cs+in:file{(filename == null ? "" : $"+filename:{filename}")}+{search.Replace(' ', '+')}&per_page=100&page={i}";
extra = $"?q=repo:discord-net/Discord.Net+language:cs+in:file{(filename == null ? "" : $"+filename:{filename}")}+{search.Replace(' ', '+')}&per_page=100&page={i}";
result = await SendRequestAsync(HttpMethod.Get, "/search/code", extra);
items = (JArray)result["items"];
foreach (var item in items)
Expand Down
7 changes: 7 additions & 0 deletions src/DiscordNet/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ namespace DiscordNet
{
public static class Utils
{
public static string ResolveHtml(string html)
{
//TODO: Pass summary, replace \n's with spaces, replace </p>'s with \n's, strip tags, decode html
//ISSUE: <p></p> could be empty, check for \n on first char
return "";
}

public static IEnumerable<T> RandomShuffle<T>(this IEnumerable<T> source)
=> source.Select(t => new {Index = Guid.NewGuid(), Value = t}).OrderBy(p => p.Index).Select(p => p.Value);

Expand Down

0 comments on commit 18d7488

Please sign in to comment.