Skip to main content

Yet Another TagScript fork. An easy drop in user-provided Templating system.

Project description

ya_tagscript - Yet Another TagScript fork

Current stable version: v1.5.0

Information

This is a fork of PhenoM4n4n's TagScript, which itself is a fork of JonSnowbd's TagScript, a string templating language.

The main purpose of this fork is to align the Discord-specific blocks with the most recent Discord and discord.py changes (new username system, etc.).

What?

TagScript is a drop-in, easy-to-use string interpreter that lets you provide users with ways of customizing their profiles or chat rooms with interactive text.

For example TagScript comes out of the box with a random block that would let users provide a template that produces a new result each time its ran, or assign math and variables for later use.

Changes in v1

The newly released v1 includes a complete rewrite of the entire parsing and interpretation performed by the TagScriptInterpreter class. This comes with some subtle behavioural changes but great care was taken to keep v1 behaviourally similar to v0 and PhenoM4n4n's fork. Most simple uses should behave the same but especially deeply nested scripts or dynamically assembled ones will most likely require adjustments. Some documentation examples were also outright wrong, so those were also adjusted to reflect the actual behaviour of the pre-existing interpreter.

Oh, no! Behaviour changes?!

To remove the need for dynamically assembled blocks (e.g. command blocks that only happen under some circumstances), v1 only performs interpretation of branches that were actually hit (to the best of its ability).

Take this (very bad) password check script:

{if({args}==123):{command:echo password accepted!}|something else}

If {args} is not in fact equal to 123, the interpreter WILL NOT interpret the command block AT ALL. It jumps straight to the else section after the | and only interprets that. This means that for any incorrect values of {args}, the echo command is NOT included in the list of commands in response.actions.get("commands").

Other blocks with some conditional executions (like all or any) do the same.

Installation

Download the latest version through pip:

pip install ya_tagscript

or

pip install git+https://github.com/MajorTanya/ya_tagscript.git@v1.5.0

Download from a commit:

pip install git+https://github.com/MajorTanya/ya_tagscript.git@<COMMIT_HASH>

Install for editing/development:

git clone https://github.com/MajorTanya/ya_tagscript.git
pip install -e ./ya_tagscript

Dependencies

  • Python>=3.11
    • before v1.4.0, this was effectively >=3.12 due to an oversight in testing
    • after v1.4.0, Python 3.11 is actually supported
  • discord.py>=2.5.0
  • pyparsing>=3.2.0
  • python-dateutil>=2.9.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ya_tagscript-1.5.0.tar.gz (205.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ya_tagscript-1.5.0-py3-none-any.whl (86.1 kB view details)

Uploaded Python 3

File details

Details for the file ya_tagscript-1.5.0.tar.gz.

File metadata

  • Download URL: ya_tagscript-1.5.0.tar.gz
  • Upload date:
  • Size: 205.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ya_tagscript-1.5.0.tar.gz
Algorithm Hash digest
SHA256 f786db170d45518afe8d70ec54b57e363fe674e456fc0dc59494133637198652
MD5 b2094e41e5a9ad11c1ac3dd70aea0a48
BLAKE2b-256 df0457a9c5b607dd5db17286e2c07b97f54e7e3e9c4a0a1ec3e9d2fe76e18eff

See more details on using hashes here.

Provenance

The following attestation bundles were made for ya_tagscript-1.5.0.tar.gz:

Publisher: publish.yml on MajorTanya/ya_tagscript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ya_tagscript-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: ya_tagscript-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 86.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ya_tagscript-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0ca0aed34418a04fac82f891b6ecd4a2638c09ae0b190a8af601189ffc25b7e
MD5 fef7f297c4c07ce17fcc7b04709d123b
BLAKE2b-256 6afc12875d04dfd6a29654b6d6d1d4da559f725e93094fb8a2cb8b4519e6186e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ya_tagscript-1.5.0-py3-none-any.whl:

Publisher: publish.yml on MajorTanya/ya_tagscript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page