Exemple #1
0
 protected ILiteCollection <TEntity> GetCollection()
 {
     if (this.collection == null)
     {
         this.collection = this.context.GetDatabase().GetCollection <TEntity>();
     }
     return(this.collection);
 }
Exemple #2
0
 public LiteDbDbSet(ILiteDbContext context)
 {
     this.context = context;
     this.context.OnDatabaseDisposed += (s, e) =>
     {
         this.collection = null;
     };
 }
        public Bot(string channel, string token, string Username, List <command> commandList, List <sfx> sfxList, LiteDB.ILiteCollection <counter> countersCol, LiteDB.ILiteCollection <swearJarAcc> accountsColl, List <string> ctList, bool requireModBool, bool quoteBool, bool isPrettyBool, bool coinBool, bool diceBool, int pretyInt, bool sjBool, float sjDenom, bool dadJ)
        {
            countersList = ctList;
            counters     = countersCol;
            commands     = commandList;
            sfxes        = sfxList;
            quote        = quoteBool;
            requireMod   = requireModBool;
            pretty       = isPrettyBool;
            dice         = diceBool;
            coin         = coinBool;
            swearJar     = sjBool;
            pretyIntVal  = pretyInt;
            accounts     = accountsColl;
            dadBool      = dadJ;


            denomination = sjDenom;
            if (Username == "")
            {
                Username = "******";
            }
            if (token == "")
            {
                token = "oauth:x64c6vsc9pfxnajwp16slxhusuiy9e";
            }
            ConnectionCredentials credentials = new ConnectionCredentials(Username, token);

            WebSocketClient customClient = new WebSocketClient();

            client = new TwitchClient(customClient);
            client.Initialize(credentials, channel);

            client.OnLog             += Client_OnLog;
            client.OnJoinedChannel   += Client_OnJoinedChannel;
            client.OnMessageReceived += Client_OnMessageReceived;
            //client.OnWhisperReceived += Client_OnWhisperReceived;
            //client.OnNewSubscriber += Client_OnNewSubscriber;
            client.OnConnected       += Client_OnConnected;
            client.OnDisconnected    += Client_OnDisconnected;
            client.OnConnectionError += onConnectionError;


            client.Connect();
        }