public static SqlTwitchConnection[] GetAllAutoConnectingConnections(SqlTwitchBot bot)
        {
            object[][] results = _table.Select(null, null, "BotUserId=?a and AutoConnectToChat=?b", new object[] { bot.user.id, true }, null, 0);
            if(results != null && results.Length > 0) {
                SqlTwitchConnection[] connections = new SqlTwitchConnection[results.Length];
                for(int i = 0; i < results.Length; i++) {
                    connections[i] = new SqlTwitchConnection(bot, new SqlTwitchChannel(new SqlTwitchUser((uint)results[i][1])), (ulong)results[i][2] != 0);
                }

                return connections;
            }

            return null;
        }
Esempio n. 2
0
        public static SqlTwitchBot[] GetAll()
        {
            List<object[]> results = _table.Select(null, null, null, null, null, 0);
            if (results != null)
            {
                SqlTwitchBot[] bots = new SqlTwitchBot[results.Count];
                for (int i = 0; i < results.Count; i++)
                {
                    bots[i] = new SqlTwitchBot(new SqlTwitchUser(results[i][0].FromSql<uint>()), results[i][1].FromSql<string>());
                }

                return bots;
            }
            else
            {
                return null;
            }
        }
 public SqlTwitchConnection(SqlTwitchBot bot, SqlTwitchChannel channel, bool autoConnectToChat = false)
     : base(new object[] { bot.user.id, channel.user.id, autoConnectToChat })
 {
     this.bot = bot;
     this.channel = channel;
 }