///<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); }
///<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); }
public static GenericBan SaveBanToGuild(GenericBan ban, ulong guildId) => MongoEngine.SaveBanToGuild(ban, guildId);