Blyx Nest Blyx language
Registry / Framework
framework · v0.1.2

Comment Appeals

Preserve a moderation case ID across hiding, appeal, review and restoration.

Source repository · Package JSON

Use Comment Appeals

use vendor::comment_appeals::comment_appeals;

Run the example

nest demo comment_appeals@0.1.2
blyxc native-run comment_appeals-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::comment_appeals::comment_appeals;

fn main() {
    let arguments = cli_args();
    if args_len(arguments) > 0 {
        if args_len(arguments) % 2 != 0 {
            stderr_line("Expected event and value pairs");
            process_exit(2);
        }
        let mut live = comment_appeals_start();
        let mut i = 0;
        while i < args_len(arguments) {
            let input = args_at(arguments, i + 1);
            if !text_is_number(input) {
                stderr_line("Expected a whole numeric event value");
                process_exit(2);
            }
            live = comment_appeals_step(live, args_at(arguments, i), text_number(input));
            let command = comment_appeals_command(live);
            println!(command);
            if command == "reject" { process_exit(1); }
            i += 2;
        }
        return;
    }
    let mut state = comment_appeals_start();
    state = comment_appeals_step(state, "flag", 71.0);
    println!(comment_appeals_command(state));
    state = comment_appeals_step(state, "hide", 71.0);
    println!(comment_appeals_command(state));
    state = comment_appeals_step(state, "appeal", 70.0);
    println!(comment_appeals_command(state));
    state = comment_appeals_step(state, "appeal", 71.0);
    println!(comment_appeals_command(state));
    state = comment_appeals_step(state, "reverse", 71.0);
    println!(comment_appeals_command(state));
}

Expected output

open_case
suppress
reject
request_second_review
restore

Published versions

VersionPackageSource commitSHA-256
0.1.2Download ZIP · Browse files0e1daf4bef7bd41e96f5125b596a29dfbef9c6f8b1e49eaf6c9b4b2472128bf2e05741aa44
0.1.1Download ZIP · Browse files266e63cc86c7c9170fb20731dd644481d84e41c536a8483b6b2307542910076f3649fb8cc9
0.1.0Download ZIP · Browse files6349f23784576ee8b41badc35bf4a1309d467be42f3fcf2aae53412cb94fb56883666648d0