diff --git a/dist/scorer/feature/chaosFeatureScorer.js b/dist/scorer/feature/chaosFeatureScorer.js index 067b4d2..224be80 100644 --- a/dist/scorer/feature/chaosFeatureScorer.js +++ b/dist/scorer/feature/chaosFeatureScorer.js @@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const FeatureScorer_1 = __importDefault(require("../FeatureScorer")); +const Storage_1 = __importDefault(require("../../Storage")); class chaosFeatureScorer extends FeatureScorer_1.default { constructor() { super({ @@ -14,6 +15,10 @@ class chaosFeatureScorer extends FeatureScorer_1.default { }); } async score(api, status) { + if (status.topPost) + return 0; + const lastOpened = await Storage_1.default.getLastOpened() || 0; + const percent = (Date.now() - lastOpened) < (1000 * 60 * 60 * 6) ? 0.5 : 0.9; return Math.random() > 0.9 ? 1 : 0; } } diff --git a/src/scorer/feature/chaosFeatureScorer.ts b/src/scorer/feature/chaosFeatureScorer.ts index 488f0ca..2bb6a0e 100644 --- a/src/scorer/feature/chaosFeatureScorer.ts +++ b/src/scorer/feature/chaosFeatureScorer.ts @@ -1,6 +1,7 @@ import FeatureScorer from '../FeatureScorer' import { StatusType, accFeatureType } from '../../types' import { mastodon } from 'masto' +import Storage from '../../Storage' export default class chaosFeatureScorer extends FeatureScorer { constructor() { @@ -13,6 +14,8 @@ export default class chaosFeatureScorer extends FeatureScorer { } async score(api: mastodon.rest.Client, status: StatusType) { if (status.topPost) return 0 + const lastOpened = await Storage.getLastOpened() || 0 + const percent = (Date.now() - lastOpened) < (1000 * 60 * 60 * 6) ? 0.5 : 0.9 return Math.random() > 0.9 ? 1 : 0 } } \ No newline at end of file