This commit is contained in:
Master Kwoth 2016-02-06 18:16:49 +01:00
parent 4e66f7eac0
commit ec9dd33a02
2 changed files with 11 additions and 7 deletions

View File

@ -68,7 +68,7 @@ namespace NadekoBot.Classes.Music {
VoiceClient = await NadekoBot.client.Audio().Join(VoiceChannel); VoiceClient = await NadekoBot.client.Audio().Join(VoiceChannel);
Console.WriteLine($"Joined voicechannel [{DateTime.Now.Second}]"); Console.WriteLine($"Joined voicechannel [{DateTime.Now.Second}]");
} }
await Task.Factory.StartNew(async () => await CurrentSong.Start(), TaskCreationOptions.LongRunning).Unwrap(); await Task.Factory.StartNew(async () => await CurrentSong?.Start(), TaskCreationOptions.LongRunning).Unwrap();
} catch (Exception ex) { } catch (Exception ex) {
Console.WriteLine($"Starting failed: {ex}"); Console.WriteLine($"Starting failed: {ex}");
CurrentSong?.Stop(); CurrentSong?.Stop();

View File

@ -212,17 +212,21 @@ namespace NadekoBot.Modules {
.Do(async e => { .Do(async e => {
if (string.IsNullOrWhiteSpace(e.GetArg("usr"))) if (string.IsNullOrWhiteSpace(e.GetArg("usr")))
return; return;
try {
using (WebClient cl = new WebClient()) { using (WebClient cl = new WebClient()) {
try {
cl.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); cl.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
cl.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 6.2; Win64; x64)"); cl.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 6.2; Win64; x64)");
cl.DownloadDataAsync(new Uri($"http://lemmmy.pw/osusig/sig.php?uname={ e.GetArg("usr") }&flagshadow&xpbar&xpbarhex&pp=2")); cl.DownloadDataAsync(new Uri($"http://lemmmy.pw/osusig/sig.php?uname={ e.GetArg("usr") }&flagshadow&xpbar&xpbarhex&pp=2"));
cl.DownloadDataCompleted += async (s, cle) => { cl.DownloadDataCompleted += async (s, cle) => {
try {
await e.Channel.SendFile($"{e.GetArg("usr")}.png", new MemoryStream(cle.Result)); await e.Channel.SendFile($"{e.GetArg("usr")}.png", new MemoryStream(cle.Result));
await e.Send($"`Profile Link:`https://osu.ppy.sh/u/{Uri.EscapeDataString(e.GetArg("usr"))}\n`Image provided by https://lemmmy.pw/osusig`");
} catch (Exception) { }
}; };
}
} catch (Exception ex) { } catch (Exception ex) {
await e.Channel.SendMessage(":anger: " + ex.Message); await e.Channel.SendMessage(":anger: Failed retrieving osu signature :\\");
}
} }
}); });