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,9 +79,10 @@ namespace NadekoBot.Classes.Music {
if (OnResolving != null) if (OnResolving != null)
OnResolving(); OnResolving();
var links = await Searches.FindYoutubeUrlByKeywords(Query); 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 var video = videos
.Where(v => v.AdaptiveKind == AdaptiveKind.Audio) .Where(v => v.AudioBitrate < 256)
.OrderByDescending(v => v.AudioBitrate) .OrderByDescending(v => v.AudioBitrate)
.FirstOrDefault(); .FirstOrDefault();

View File

@ -143,13 +143,13 @@ namespace NadekoBot {
if (ForwardMessages && OwnerUser != null) if (ForwardMessages && OwnerUser != null)
await OwnerUser.SendMessage(e.User + ": ```\n" + e.Message.Text + "\n```"); 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"); 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(); Timer t = new Timer();
t.Interval = 2000; t.Interval = 2000;
t.Start(); t.Start();
t.Elapsed += (s, ev) => { t.Elapsed += (s, ev) => {
repliedRecently = !repliedRecently; repliedRecently = false;
t.Stop(); t.Stop();
t.Dispose(); t.Dispose();
}; };