3.0.2 • Published 3 years ago

@midowo/tokyo-script.ts v3.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@midowo/tokyo-script.ts

Custom package made by Mid with basic string-based functions and variables.

Usage:

import { TokyoScript, FunctionStructure } from '@midowo/tokyo-script.ts'

const Parser = new Parser(MyDiscordClient, {
    brackets: 1, // 1 for '{}' and 2 for '[]'
    separator: ',',
    allowEmbeds: true,
    ignore: []
})

// Adding custom functions
Parser.addFunction({
    name: 'uppercase',
    code: (text: string, data: FunctionStructure) => {
    return text.replace(data.itself, data.inside.toUpperCase())
}
})
// Deleting functions
Parser.deleteFunction('uppercase')
// Adding custom variables
Parser.addVariable('hi', 'bye') // {hi} will be replaced to bye
// Deleting variables
Parser.deleteVariable('hi')

// The parser itself:
Parser.interprete('hi {USER.NAME}', interaction)
// With messages:
Parser.interprete('hi {USER.NAME}', message)

// TIP: to escape a bracket you can use \\ before it, like: \\}

Function Structure:

{
    name: string,
    regexp: RegExpMatchArray | null,
    inside: string,
    itself: string,
    splits: string[]
}
3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.5

3 years ago

2.0.3

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.8

3 years ago

1.0.5

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.9.0

3 years ago