reduced bandwidth usage, quality should be the same. Fixed reply bug

This commit is contained in:
Master Kwoth 2016-02-10 13:44:19 +01:00
parent bfc3acd40d
commit bbb336f1a3
2 changed files with 7 additions and 6 deletions

View File

@ -79,11 +79,12 @@ namespace NadekoBot.Classes.Music {
if (OnResolving != null)
OnResolving();
var links = await Searches.FindYoutubeUrlByKeywords(Query);
var videos = await YouTube.Default.GetAllVideosAsync(links);
var allVideos = await YouTube.Default.GetAllVideosAsync(links);
var videos = allVideos.Where(v => v.AdaptiveKind == AdaptiveKind.Audio);
var video = videos
.Where(v => v.AdaptiveKind == AdaptiveKind.Audio)
.OrderByDescending(v => v.AudioBitrate)
.FirstOrDefault();
.Where(v => v.AudioBitrate < 256)
.OrderByDescending(v => v.AudioBitrate)
.FirstOrDefault();
if (video == null) // do something with this error
throw new Exception("Could not load any video elements based on the query.");

View File

@ -143,13 +143,13 @@ namespace NadekoBot {
if (ForwardMessages && OwnerUser != null)
await OwnerUser.SendMessage(e.User + ": ```\n" + e.Message.Text + "\n```");
if (repliedRecently = !repliedRecently) {
if (!repliedRecently) {
await e.Send("**COMMANDS DO NOT WORK IN PERSONAL MESSAGES**\nYou can type `-h` or `-help` or `@MyName help` in any of the channels I am in and I will send you a message with my commands.\n Or you can find out what i do here: https://github.com/Kwoth/NadekoBot\nYou can also just send me an invite link to a server and I will join it.\nIf you don't want me on your server, you can simply ban me ;(\nBot Creator's server: https://discord.gg/0ehQwTK2RBhxEi0X");
Timer t = new Timer();
t.Interval = 2000;
t.Start();
t.Elapsed += (s, ev) => {
repliedRecently = !repliedRecently;
repliedRecently = false;
t.Stop();
t.Dispose();
};