public static SongStruct CreateSongStruct(ref FileStruct.TSAreaSong tsAreaSong) { SongStruct ss = new SongStruct(); ss.daySong = tsAreaSong.daySong; ss.nightSong = tsAreaSong.nightSong; ss.winSong = tsAreaSong.winSong; ss.battleSong = tsAreaSong.battleSong; ss.loseSong = tsAreaSong.loseSong; ss.resDayAmbient1 = Utils.CharsToString(tsAreaSong.resDayAmbient1).ToUpper(); ss.resDayAmbient2 = Utils.CharsToString(tsAreaSong.resDayAmbient2).ToUpper();; ss.dayAmbientVol = tsAreaSong.dayAmbientVol; ss.resNightAmbient1 = Utils.CharsToString(tsAreaSong.resNightAmbient1).ToUpper(); ss.resNightAmbient2 = Utils.CharsToString(tsAreaSong.resNightAmbient2).ToUpper(); ss.nightAmbientVol = tsAreaSong.nightAmbientVol; return(ss); }
public async Task AddQueue(string url, SocketCommandContext Context) { try { IAudioClient aClient; audioDict.TryGetValue(Context.Guild.Id, out aClient); if (aClient == null) { await Context.Channel.SendMessageAsync(":no_entry_sign: Bot is not connected to any Voice Channels"); return; } var _channel = (Context.Message.Author as IGuildUser)?.VoiceChannel; if (_channel == null) { await Context.Channel.SendMessageAsync( ":no_entry_sign: You must be in the same Voice Channel as me!"); return; } var channel = (Context.Guild as SocketGuild).CurrentUser.VoiceChannel as IVoiceChannel; if (channel.Id != _channel.Id) { await Context.Channel.SendMessageAsync(":no_entry_sign: You must be in the same Voice Channel as the me!"); return; } var msg = await Context.Channel.SendMessageAsync( ":arrows_counterclockwise: Downloading and Adding to Queue..."); string nameT = await Download(url, msg, Context); if (!nameT.Equals("f")) { List <SongStruct> tempList = new List <SongStruct>(); SongStruct tempStruct = new SongStruct { name = nameT, user = $"{Context.User.Username}#{Context.User.Discriminator}" }; if (queueDict.ContainsKey(Context.Guild.Id)) { queueDict.TryGetValue(Context.Guild.Id, out tempList); tempList.Add(tempStruct); queueDict.TryUpdate(Context.Guild.Id, tempList); } else { tempList.Add(tempStruct); queueDict.TryAdd(Context.Guild.Id, tempList); } SaveDatabase(); } } catch (Exception e) { Console.WriteLine(e); } }
public async Task AddQueueYT(SocketCommandContext Context, string name, InteractiveService interactive) { try { IAudioClient aClient; audioDict.TryGetValue(Context.Guild.Id, out aClient); if (aClient == null) { await Context.Channel.SendMessageAsync(":no_entry_sign: Bot is not connected to any Voice Channels"); return; } var _channel = (Context.Message.Author as IGuildUser)?.VoiceChannel; if (_channel == null) { await Context.Channel.SendMessageAsync( ":no_entry_sign: You must be in the same Voice Channel as me!"); return; } var channel = (Context.Guild as SocketGuild).CurrentUser.VoiceChannel as IVoiceChannel; if (channel.Id != _channel.Id) { await Context.Channel.SendMessageAsync(":no_entry_sign: You must be in the same Voice Channel as the me!"); return; } var msg = await Context.Channel.SendMessageAsync( ":arrows_counterclockwise: Searching, Downloading and Adding to Queue..."); string tempName = await _ytService.GetYtURL(Context, name, interactive, msg); if (tempName == "f") { await msg.ModifyAsync(x => { x.Content = ":no_entry_sign: Failed to get any results!"; }); return; } else if (tempName == "f2") { return; } string nameT = await Download(tempName, msg, Context); if (!nameT.Equals("f")) { List <SongStruct> tempList = new List <SongStruct>(); SongStruct tempStruct = new SongStruct { name = nameT, user = $"{Context.User.Username}#{Context.User.Discriminator}" }; if (queueDict.ContainsKey(Context.Guild.Id)) { queueDict.TryGetValue(Context.Guild.Id, out tempList); tempList.Add(tempStruct); queueDict.TryUpdate(Context.Guild.Id, tempList); } else { tempList.Add(tempStruct); queueDict.TryAdd(Context.Guild.Id, tempList); } SaveDatabase(); //await Context.Channel.SendMessageAsync(":musical_note: Successfully Downloaded. Will play shortly"); } } catch (Exception e) { Console.WriteLine(e); await SentryService.SendError(e, Context); } }