RE: Update Bot auto curation

You are viewing a single comment's thread:

part 2

...
// ----------- LOGIQUE PRINCIPALE -----------
$account = get_hive_account(VOTER_ACCOUNT);
$current_vp = get_current_vp(VOTER_ACCOUNT);
$posts = get_hive_posts();

$eligible_posts = [];
$debug_logs = [];

foreach ($posts as $p) {
$words = count_words($p['body']);
$vote_weight = get_vote_weight($words);
$user_voted = false;
$reason = "";

foreach ($p['active_votes'] ?? [] as $vote) {
    if ($vote['voter'] === VOTER_ACCOUNT) {
        $user_voted = true;
        $reason = "Already voted";
        break;
    }
}

if ($words < MIN_WORD_COUNT) {
    $reason = "Too short ($words words)";
} elseif ($user_voted) {
    $reason = "Already voted";
} else {
    $reason = "✅ Eligible";
}

$debug_logs[] = [
    'author' => $p['author'],
    'permlink' => $p['permlink'],
    'words' => $words,
    'reason' => $reason
];

if ($vote_weight > 0 && !$user_voted && $current_vp >= MIN_VP_THRESHOLD) {
    $p['is_eligible'] = true;
    $eligible_posts[] = $p;
}

}
?>

🤖 Hive Auto Words :root { --neon-blue: #00d4ff; --neon-purple: #b200ff; --neon-green: #00ff88; --neon-red: #ff2e63; --neon-yellow: #ffc700; --bg-dark: #0a0a1a; --bg-card: #121230; --text-primary: #e0e0ff; --text-secondary: #a0a0c0; }
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    body {
        font-family: 'Rajdhani', sans-serif;
        background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 100%);
        color: var(--text-primary);
        padding: 40px 20px;
        min-height: 100vh;
    }

    h1 {
        font-family: 'Orbitron', sans-serif;
        text-align: center;
        font-size: 2.5rem;
        margin-bottom: 40px;
        background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    }

    .card {
        background: rgba(18, 18, 48, 0.9);
        border: 1px solid rgba(178, 0, 255, 0.2);
        border-radius: 15px;
        padding: 25px;
        margin-bottom: 30px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }

    .card h2 {
        font-family: 'Orbitron', sans-serif;
        color: var(--neon-purple);
        margin-bottom: 20px;
        font-size: 1.5rem;
    }

    .card p {
        font-size: 1.1rem;
        margin-bottom: 12px;
        color: var(--text-secondary);
    }

    .card strong {
        color: var(--text-primary);
    }

    .vp-container {
        background: rgba(10, 10, 30, 0.5);
        padding: 15px;
        border-radius: 10px;
        margin: 15px 0;
    }

    .vp-bar {
        width: 100%;
        height: 20px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 10px;
        overflow: hidden;
        margin-top: 10px;
    }

    .vp-fill {
        height: 100%;
        width: <?php echo $current_vp; ?>%;
        background: linear-gradient(90deg, var(--neon-green), var(--neon-yellow));
        transition: width 0.5s ease;
    }

    table {
        width: 100%;
        border-collapse: collapse;
        background: rgba(18, 18, 48, 0.6);
        border-radius: 10px;
        overflow: hidden;
    }

    th, td {
        padding: 15px;
        text-align: left;
        border-bottom: 1px solid rgba(178, 0, 255, 0.1);
    }

    th {
        background: rgba(178, 0, 255, 0.1);
        color: var(--neon-purple);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-size: 0.9rem;
    }

    tr:hover {
        background: rgba(0, 212, 255, 0.05);
    }

    button {
        padding: 8px 16px;
        border: none;
        border-radius: 6px;
        font-family: 'Rajdhani', sans-serif;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s;
        background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));
        color: white;
        box-shadow: 0 4px 6px rgba(0, 212, 255, 0.2);
        position: relative;
        overflow: hidden;
    }

    button:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(0, 212, 255, 0.3);
    }

    button:active {
        transform: translateY(0);
    }

    button:disabled {
        background: #3a3a5a;
        color: #666;
        cursor: not-allowed;
        box-shadow: none;
    }

    button.voted {
        background: linear-gradient(90deg, var(--neon-green), var(--neon-yellow));
        animation: pulse 1.5s infinite;
    }

    @keyframes pulse {
        0% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4); }
        70% { box-shadow: 0 0 0 10px rgba(0, 255, 136, 0); }
        100% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0); }
    }

    .debug-table {
        margin-top: 40px;
        border-top: 1px solid rgba(178, 0, 255, 0.2);
        padding-top: 30px;
    }

    .debug-table h2 {
        color: var(--neon-purple);
        text-shadow: 0 0 8px rgba(178, 0, 255, 0.3);
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .card, table, h1, h2 {
        animation: fadeIn 0.5s ease-out forwards;
    }

    .history-item {
        background: rgba(10, 10, 30, 0.7);
        border: 1px solid rgba(178, 0, 255, 0.3);
        border-radius: 10px;
        padding: 15px;
        display: grid;
        grid-template-columns: 80px 1fr auto;
        gap: 15px;
        align-items: center;
        transition: all 0.3s ease;
    }

    .history-item:hover {
        background: rgba(0, 212, 255, 0.1);
        border-color: var(--neon-blue);
        transform: translateX(5px);
        box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
    }

    .history-avatar {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        border: 2px solid var(--neon-purple);
        object-fit: cover;
    }

    .history-content {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .history-author {
        font-weight: bold;
        color: var(--neon-blue);
        text-decoration: none;
        font-size: 1.1rem;
    }

    .history-author:hover {
        color: var(--neon-purple);
    }

    .history-post-link {
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.9rem;
    }

    .history-post-link:hover {
        color: var(--neon-green);
    }

    .history-meta {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }

    .history-weight {
        background: linear-gradient(90deg, var(--neon-purple), var(--neon-blue));
        padding: 6px 12px;
        border-radius: 6px;
        font-weight: bold;
        font-size: 0.95rem;
    }

    .history-time {
        color: var(--text-secondary);
        font-size: 0.85rem;
    }

    .status-badge {
        padding: 6px 12px;
        border-radius: 6px;
        font-size: 0.85rem;
        font-weight: 600;
        text-align: center;
    }

    .status-success {
        background: rgba(0, 255, 136, 0.2);
        color: var(--neon-green);
        border: 1px solid rgba(0, 255, 136, 0.3);
    }

    .status-failed {
        background: rgba(255, 46, 99, 0.2);
        color: var(--neon-red);
        border: 1px solid rgba(255, 46, 99, 0.3);
    }

    .status-loading {
        background: rgba(0, 212, 255, 0.2);
        color: var(--neon-blue);
        border: 1px solid rgba(0, 212, 255, 0.3);
    }

    @keyframes pulse-glow {
        0%, 100% {
            box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
            border-color: rgba(0, 212, 255, 0.4);
        }
        50% {
            box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6);
            border-color: rgba(0, 212, 255, 0.8);
        }
    }

    @media (max-width: 768px) {
        body { padding: 15px; }
        .card { padding: 15px; }
        th, td { padding: 8px 10px; }
        h1 { font-size: 1.8rem; }
    }
</style>

🤖 HIVE AUTO WORDS Edition

(html comment removed:  ========== PATCH COMPLET : OPTIONS EN HAUT DE PAGE ========== )
<h2 style="
    margin: 0 0 20px 0;
    color: var(--neon-purple);
    font-family: 'Orbitron', sans-serif;
    text-shadow: 0 0 10px var(--neon-purple);
    display: flex;
    align-items: center;
    gap: 10px;
">
    ⚙️ Configuration Panel
</h2>

<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px;">

    (html comment removed:  Colonne 1 )
    <div>
        <h3 style="color: var(--neon-blue); margin-bottom: 12px; font-size: 1rem;">🔐 Voting Account</h3>
        <div style="display: flex; gap: 10px; margin-bottom: 15px;">
            <input 
                type="text" 
                id="account-input" 
                placeholder="Enter Hive username"
                style="flex: 1; padding: 12px; background: rgba(0,0,0,0.4); border: 1px solid rgba(0,212,255,0.3); border-radius: 8px; color: white;"
            />
            <button 
                id="connect-btn" 
                onclick="connectAccount()"
                style="padding: 12px 20px; white-space: nowrap; background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));">
                🔗 Connect
            </button>
        </div>
        <div id="account-status" style="padding: 10px; border-radius: 6px; font-size: 0.9rem; min-height: 20px;"></div>
    </div>

    (html comment removed:  Colonne 2 )
    (html comment removed:  Colonne Voting Power - VERSION AMÉLIORÉE (visible et mise à jour) )

⚡ Voting Power

<div style="background: rgba(0,0,0,0.3); padding: 15px; border-radius: 10px; border: 1px solid rgba(255, 215, 0, 0.2);">
    <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
        <span style="color: var(--text-secondary);">Current VP :</span>
        <span id="current-vp-display" style="font-size: 2rem; font-weight: bold; color: var(--neon-green); font-family: 'Orbitron', sans-serif;">--</span>
        <span style="color: var(--neon-yellow); font-size: 1.1rem;">%</span>
    </div>
    
    <div style="height: 6px; background: rgba(255,255,255,0.1); border-radius: 999px; overflow: hidden;">
        <div id="vp-bar" style="height: 100%; background: linear-gradient(90deg, #00ff88, #00d4ff); width: 78%; border-radius: 999px;"></div>
    </div>
    
    <div style="margin-top: 12px; font-size: 0.85rem; color: var(--text-secondary);">
        Minimum pour voter : 
        <input id="vp-threshold" type="number" min="1" max="100" value="78" style="width: 55px; background: rgba(0,0,0,0.6); border: 1px solid var(--neon-yellow); color: white; border-radius: 4px; padding: 2px 6px;">
        <span>%</span>
    </div>
</div>
    (html comment removed:  Colonne 3 )
    <div>
        <h3 style="color: var(--neon-green); margin-bottom: 12px; font-size: 1rem;">🗳️ Vote Counter</h3>
        <div style="font-size: 2rem; font-family: 'Orbitron', sans-serif; color: var(--neon-green);">
            <span id="vote-count">0</span> <span style="font-size: 1rem; color: var(--text-secondary);">votes</span>
        </div>
    </div>

</div>

(html comment removed:  Vote Rules Editor )
<div style="margin-top: 25px; padding-top: 20px; border-top: 1px solid rgba(178, 0, 255, 0.2);">
    <h3 style="color: var(--neon-purple); margin-bottom: 12px;">📏 Vote Weight Rules</h3>
    <div id="rules-container" style="display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px;"></div>
    <button onclick="addRule()" style="
        background: linear-gradient(90deg, #00d4ff, #b200ff);
        color: white;
        border: none;
        padding: 10px 18px;
        border-radius: 8px;
        cursor: pointer;
        font-weight: 600;
    ">
        ➕ Add New Rule
    </button>
</div>
    
    <div style="text-align: right;">
        <button onclick="clearVoteHistory()" style="
            background: #ff0040;
            color: white;
            border: none;
            padding: 10px 16px;
            border-radius: 8px;
            margin-right: 10px;
        ">
            🗑️ Clear History
        </button>
        <button onclick="exportVotedAccountsCSV()" style="
            background: linear-gradient(90deg, #b200ff, #00d4ff);
            color: white;
            border: none;
            padding: 10px 16px;
            border-radius: 8px;
        ">
            📥 Export CSV
        </button>
    </div>
</div>
...


0
0
0.000
0 comments