Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

Readme.md

SanaJK

npm npm license npm download total npm download by month npm type definitions

Dependency Status devDependency Status build

Ukagaka SHIORI subsystem 'SanaJK'

see also create-sanajk-ghost

Install

npm:

npm install sanajk

Usage

import * as SanaJK from "sanajk";

const r = String.raw;
const myState = {
  bar: "bar",
  day: 0, // Sunday
};

const builder = new SanaJK.SanaShioriBuilder()
  .use({ state: myState })
  .useDefaults();

const events = builder.state.events;
events.OnBoot = () => r`\0\s[0]Boot!\e`;
events.OnMyEvent = (ctx) => r`\0\s[0]foo ${ctx.state.bar} baz\e`;

const { auto, autow, chain } = SanaJK;
const autoTalks = builder.state.autoTalks;
autoTalks.add(
  r`\0\s[0]random talk!\e`,
  auto(["tag1"], r`\0\s[0]tagged random talk!\e`),
  autow(5, r`\0\s[0]weight grouped random talk!\e`, r`\0\s[0]one more!\e`),
  autow(
    (ctx) => (new Date().getDay() === ctx.state.day ? 1 : 0),
    (ctx) => r`\0\s[0]Today is day=${ctx.state.day}!\e`
  ),
  chain(
    r`\0\s[0]chain talk!\e`,
    auto(
      chain(r`\0\s[0]nested chain talk 1!\e`, r`\0\s[0]one more!\e`),
      chain(r`\0\s[0]nested chain talk 2!\e`, r`\0\s[0]one more!\e`)
    ),
    r`\0\s[0]done!\e`
  )
);

export = builder.build();
shiolinkjs ./shiori.js

API

https://narazaka.github.io/sanajk/

License

This is released under Zlib License.

About

Ukagaka SHIORI subsystem 'SanaJK'

Topics

Resources

Packages

No packages published