예제 #1
0
        ///<inheritdoc cref="IDatabaseEngine.SaveBanToGuild(GenericBan, ulong)"/>
        public GenericBan SaveBanToGuild(GenericBan ban, ulong guildId)
        {
            Core.Logger.LogGenericMessage($"[LiteDb] SAVED Ban {ban.Id} TO {guildId}");
            var _db = liteDatabase.GetCollection <GenericBan>($"{guildId}-bans");

            _db.Upsert(ban);
            return(ban);
        }
예제 #2
0
        ///<inheritdoc cref="IDatabaseEngine.SaveBanToGuild(GenericBan, ulong)"/>
        public GenericBan SaveBanToGuild(GenericBan ban, ulong guildId)
        {
            Core.Logger.LogGenericMessage($"[Mongo] SAVED Ban {ban.Id} TO {guildId}");

            var _userDb     = GetDatabaseFromGuildId(guildId);
            var _collection = _userDb.GetCollection <GenericBan>("bans");

            if (_collection.Find(u => u.Id == ban.Id).Any())
            {
                _collection.FindOneAndReplace(u => u.Id == ban.Id, ban);
            }
            else
            {
                _collection.InsertOne(ban);
            }
            return(ban);
        }
예제 #3
0
 public static GenericBan SaveBanToGuild(GenericBan ban, ulong guildId) =>
 MongoEngine.SaveBanToGuild(ban, guildId);