static private ReadChannels ( string condition, string value = "channel" ) : |
||
condition | string | |
value | string | |
리턴 |
internal Handler(ulong client_id, string user, string key) { // Store credentials _user = user; _key = key; // Load the chatbots var reader = SQL.ReadChannels("chatbot <> -1"); while (reader.Read()) { CreateBot(client_id.ToString(), reader["channel"].ToString()); } // Register the handler Program.Cmds.NonCommands += e => Task.Run(() => Do(e)); }
internal Task Load(DiscordClient client) { // Load the entrance gestures var reader = SQL.ReadUsers("entrance_gesture<>''", "user,entrance_gesture"); while (reader.Read()) { EntranceGestures[Convert.ToUInt64(reader["user"].ToString())] = reader["entrance_gesture"].ToString(); } // Load the stream channels var channels = new List <Tuple <Channel, int> >(); reader = SQL.ReadChannels("music<>0", "channel,music"); while (reader.Read()) { channels.Add(Tuple.Create(client.GetChannel(Convert.ToUInt64(reader["channel"].ToString())), int.Parse(reader["music"].ToString()))); } return(Task.WhenAll( channels.Select(s => s.Item1?.Type == ChannelType.Voice ? Task.Run(async() => await AddStream(s.Item1, s.Item2 == 2)) : null) .Where(t => t != null).ToArray())); }