public static async Task Comment(SocketMessage message, string[] arg, string msg) { if (arg.Count() > 1) { try { YouTubeVideo video = YouTubeHelper.Search(msg.Substring(8)); CommentThreadListResponse comments = YouTubeHelper.GetComments(video.Url.Substring(32)); if (comments == null) { await message.Channel.SendMessageAsync($":no_entry: `Could not list comments for this video`"); } else { await message.Channel.SendMessageAsync("", false, genYtComment(comments.Items.ElementAt(new Random().Next(comments.Items.Count)).Snippet.TopLevelComment.Snippet)); } } catch { await message.Channel.SendMessageAsync($":no_entry: `That video doesn't exist n***a`:joy:"); } } else { await message.Channel.SendMessageAsync($":no_entry: `Please include a video link`"); } }
public static async Task Youtube(SocketMessage message, string[] arg, string msg) { try { await message.Channel.SendMessageAsync(YouTubeHelper.Search(msg.Substring(3)).Url); } catch { await message.Channel.SendMessageAsync($":no_entry: `That video doesn't exist n***a`:joy:"); } }
public static async Task Play(SocketMessage message, string[] arg, string msg) { string url = msg.Substring(5); IAudioChannel channel = null; channel = channel ?? (message.Author as IGuildUser)?.VoiceChannel; try { if (!Playlist.Enabled) { Playlist.CurrentChannel = channel; if (channel != null) { new Thread(() => { Playlist.JoinChannel(channel).Wait(); }).Start(); Playlist.Enable(); } else { await message.Channel.SendMessageAsync($":no_entry: `Sorry, u aren't in a f*****g audio channel m8`"); return; } } if (Playlist.CurrentChannel == channel) { YouTubeVideo video = YouTubeHelper.Search(url); foreach (PlayListItem item in Playlist.files) { if (item.Url == video.Url) { await message.Channel.SendMessageAsync($":no_entry: `Sorry, this video is already in the playlist !`"); return; } } string tUpper = video.Title.ToUpper(); Playlist.Add(video); await message.Channel.SendMessageAsync($":white_check_mark: `'{video.Title}' has been added to the playlist !`"); } else { await message.Channel.SendMessageAsync($":no_entry: `Sorry, you are't in the same audio channel as the bot !`"); } } catch { await message.Channel.SendMessageAsync($":no_entry: `That video doesn't exist n***a`:joy:"); } }