Ejemplo n.º 1
0
        public async Task IncrementUwURecord(UwURecord uwuRecord)
        {
            var filterOne = Builders <UwURecord> .Filter.Eq("kawaekoId", _kawaekoId);

            var incrementUwUCount = Builders <UwURecord> .Update.Set("uwuCount", uwuRecord.uwuCount += 1);

            try
            {
                await _collection.UpdateOneAsync(filterOne, incrementUwUCount);

                Log.Information($"User {_message.Author} with KawaekoId {_kawaekoId} has been updated in the database");
            }
            catch (Exception e)
            {
                Log.Error($"User {_message.Author} with KawaekoId {_kawaekoId} failed updating database for reason: {e.Message}");
            }
        }
Ejemplo n.º 2
0
        public async Task InsertNewUwURecord()
        {
            var uwuDocument = new UwURecord
            {
                kawaekoId = _kawaekoId,
                guildId   = _guildId,
                userId    = _userId,
                uwuCount  = 1
            };

            try
            {
                await _collection.InsertOneAsync(uwuDocument);

                Log.Information($"User {_message.Author} with KawaekoId {_kawaekoId} has been inserted into the database");
            }
            catch (Exception e)
            {
                Log.Error($"User {_message.Author} with KawaekoId {_kawaekoId} failed inserting into database for reason: {e.Message}");
            }
        }