-
Notifications
You must be signed in to change notification settings - Fork 2
main_doc
Chris Rabe edited this page Mar 2, 2018
·
3 revisions
Function | Description |
---|---|
toFancytext(text:string) |
converts text parameter input into ascii characters that look 'fancy'. |
toFliptext(text: string) |
turns text parameter input upside-down. Returns null if a blank string or null character is passed as the parameter. |
toFliptextTable(text:string) |
similar to toFliptext but adds a flip-table asciimoticon beside the text. |
toWitchtext(text:string) |
converts text parameter input into ascii characters that look 'witch-like'. |
toCrazytext(text:string) |
convert text parameter input into ascii characters that look 'crazy'. |
toBubbletext(text:string) |
converts text parameter input into ascii characters surrounded by 'bubbles'. |
toArcanetext(text:string) |
converts text parameter input into ascii characters that look 'arcane'. |
Function | Description |
---|---|
dice(amount) |
Retrieves a die with circles specified by the amount parameter. amount must be within 1 - 6 |
randomDice() |
Retrieves a random die. |
loading(percent) |
Creates a loading bar that contains a shaded section which symbolises the percent parameter passed. |
dollarbill(amount) |
Creates a dollar bill that has the value of the amount parameter passed. |
This is a map which contains the asciimoticon and the words associated to it.
const faces = core.faces;
for (var faceName in faces) {
const face = faces[faceName];
console.log(`|${face.ascii} | ${face.words} |`); // TOO MANY TO DEFINE
}
Each object in the map contains words
and ascii
properties. To retrieve a specific face, simply access it by passing the name of the asciimoticon into the map. Here's a list of all available faces.
This is a map which contains themes mapped to arrays of asciimoticons related to that theme.
const themes = core.themes;
for(var theme in themes){
const faces = themes[theme]; // array object
console.log(faces); // TOO MANY TO DEFINE
}
Contains ascii components for specific parts.
const parts = core.parts;
// Load different array of parts
const eyes = parts.eyes;
const cheeks = parts.cheeks;
const mouth = parts.mouth;
const face = parts.face;
const arms = parts.arms;
const wings = parts.wings;
const other = parts.other;
const weapon = parts.weapon;
Function | Description |
---|---|
template() |
creates a new template object. Always use this if you want user define mappings. |
parse(text:string, options?: object, template?: object) |
parses the text and converts delimited words with asciimoticons |
build(sequence: string[], template: object) |
Builds an asciimoticon using the sequence and the custom mapping |
This functionality should be used in conjunction with core.parts
module.
const template = builder.template();
template.map('key1', 'value1');
template.map('key2', 'value2');
console.log(template.content); // {key1: 'value1', key2: 'value2'}
const template = builder.template();
template.map('key1', 'value1');
template.map('key2', 'value2');
template.delete('key1'); // deletes key1 property
console.log(template.content); // {key2: 'value2'}
const template = builder.template();
template.map('key1', 'value1');
template.map('key1', 'value2'); //overwrite template
console.log(template.content); // {key1: 'value2'}
// This one is used if you want your custom text module
const template = builder.template();
template.map('customtext', (text) => { //do stuff here });
// If you pass this into the parse function, you can use it by calling (customtext,value)
const input = '(bear)';
const output = builder.parse(input);
console.log(output); // ʕ·͡ᴥ·ʔ
const input = '(fliptext,abcdefghijklmnopqrstuvwxyz)';
const output = builder.parse(input);
console.log(output); //zʎxʍʌnʇsɹbdouɯןʞɾıɥƃɟǝpɔqɐ
const options = {
prefix: ':',
suffix: ':'
};
const input = ':bear:';
const output = builder.parse(input, options);
console.log(output); // ʕ·͡ᴥ·ʔ
// define template mapping
const template = builder.template();
template.map('custom', '(o____O)');
const input = '(custom)';
const output = builder.parse(input, null, template);
console.log(output) //(o____O)
const template = builder.template();
template.map('customtext', (text) => { //do stuff here });
const input = '(customtext,some values here)';
const output = builder.parse(input, null, template);
console.log(output); //customtext output
const template = builder.template();
template.map('eL', 'o');
template.map('eR', 'o');
template.map('fL', '(');
template.map('fR', ')');
template.map('m', '_');
const sequence = ['fL', 'eL', 'm', 'eR', 'fR'];
const output = builder.build(sequence, template);
console.log(output); //(o_o)