AdvancedTagScript 3.2.4__tar.gz → 3.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/AdvancedTagScript.egg-info/PKG-INFO +3 -4
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/AdvancedTagScript.egg-info/SOURCES.txt +1 -6
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/PKG-INFO +3 -4
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/README.md +1 -1
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/__init__.py +8 -1
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/__init__.py +4 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/case.py +3 -3
- advancedtagscript-3.2.5/TagScriptEngine/block/count.py +78 -0
- advancedtagscript-3.2.5/TagScriptEngine/block/joinblock.py +43 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/replaceblock.py +16 -9
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/stopblock.py +1 -1
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/strf.py +1 -1
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/urlencodeblock.py +2 -2
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/setup.cfg +1 -2
- advancedtagscript-3.2.4/TagScriptEngine/block/comment.py +0 -29
- advancedtagscript-3.2.4/TagScriptEngine/block/count.py +0 -68
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/AdvancedTagScript.egg-info/dependency_links.txt +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/AdvancedTagScript.egg-info/requires.txt +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/AdvancedTagScript.egg-info/top_level.txt +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/LICENSE +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/MANIFEST.in +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/_warnings.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/__init__.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/discordadapters.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/functionadapter.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/intadapter.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/objectadapter.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/redbotadapters.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/stringadapter.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/allowedmentions.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/assign.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/breakblock.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/command.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/control.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/cooldown.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/embedblock.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/fiftyfifty.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/helpers.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/loosevariablegetter.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/mathblock.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/randomblock.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/range.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/redirect.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/require_blacklist.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/shortcutredirect.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/strictvariablegetter.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/substr.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/exceptions.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/interface/__init__.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/interface/adapter.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/interface/block.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/interpreter.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/py.typed +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/utils.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/verb.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/pyproject.toml +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/setup.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/tests/test_adapters.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/tests/test_basic.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/tests/test_edgecase.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/tests/test_escapes.py +0 -0
- {advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/tests/test_verbs.py +0 -0
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AdvancedTagScript
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.5
|
|
4
4
|
Summary: An easy drop in user-provided Templating system.
|
|
5
5
|
Home-page: https://github.com/cool-aid-man/TagScriptEngine
|
|
6
6
|
Author: cool-aid-man, inthedark.org, PhenoM4n4n
|
|
7
7
|
Author-email: coolaid@duskybot.xyz
|
|
8
|
-
License:
|
|
8
|
+
License: CC-BY-4.0
|
|
9
9
|
Keywords: tagscript,string-templating,discord.py
|
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: Freely Distributable
|
|
13
12
|
Classifier: Natural Language :: English
|
|
14
13
|
Classifier: Operating System :: OS Independent
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -41,7 +40,7 @@ Dynamic: license-file
|
|
|
41
40
|
<img src="https://img.shields.io/pypi/v/AdvancedTagScript" alt="PyPI - Version">
|
|
42
41
|
</a>
|
|
43
42
|
<a href="https://advancedtagscript.readthedocs.io/en/latest/?badge=latest">
|
|
44
|
-
<img src="https://readthedocs.org/projects/
|
|
43
|
+
<img src="https://readthedocs.org/projects/AdvancedTagScript/badge/?version=latest" alt="Documentation Status" />
|
|
45
44
|
</a>
|
|
46
45
|
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
47
46
|
<img src="https://img.shields.io/pypi/dm/AdvancedTagScript" alt="PyPI - Downloads" />
|
|
@@ -9,11 +9,6 @@ AdvancedTagScript.egg-info/SOURCES.txt
|
|
|
9
9
|
AdvancedTagScript.egg-info/dependency_links.txt
|
|
10
10
|
AdvancedTagScript.egg-info/requires.txt
|
|
11
11
|
AdvancedTagScript.egg-info/top_level.txt
|
|
12
|
-
AdvancedTagscript.egg-info/PKG-INFO
|
|
13
|
-
AdvancedTagscript.egg-info/SOURCES.txt
|
|
14
|
-
AdvancedTagscript.egg-info/dependency_links.txt
|
|
15
|
-
AdvancedTagscript.egg-info/requires.txt
|
|
16
|
-
AdvancedTagscript.egg-info/top_level.txt
|
|
17
12
|
TagScriptEngine/__init__.py
|
|
18
13
|
TagScriptEngine/_warnings.py
|
|
19
14
|
TagScriptEngine/exceptions.py
|
|
@@ -34,13 +29,13 @@ TagScriptEngine/block/assign.py
|
|
|
34
29
|
TagScriptEngine/block/breakblock.py
|
|
35
30
|
TagScriptEngine/block/case.py
|
|
36
31
|
TagScriptEngine/block/command.py
|
|
37
|
-
TagScriptEngine/block/comment.py
|
|
38
32
|
TagScriptEngine/block/control.py
|
|
39
33
|
TagScriptEngine/block/cooldown.py
|
|
40
34
|
TagScriptEngine/block/count.py
|
|
41
35
|
TagScriptEngine/block/embedblock.py
|
|
42
36
|
TagScriptEngine/block/fiftyfifty.py
|
|
43
37
|
TagScriptEngine/block/helpers.py
|
|
38
|
+
TagScriptEngine/block/joinblock.py
|
|
44
39
|
TagScriptEngine/block/loosevariablegetter.py
|
|
45
40
|
TagScriptEngine/block/mathblock.py
|
|
46
41
|
TagScriptEngine/block/randomblock.py
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: AdvancedTagScript
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.5
|
|
4
4
|
Summary: An easy drop in user-provided Templating system.
|
|
5
5
|
Home-page: https://github.com/cool-aid-man/TagScriptEngine
|
|
6
6
|
Author: cool-aid-man, inthedark.org, PhenoM4n4n
|
|
7
7
|
Author-email: coolaid@duskybot.xyz
|
|
8
|
-
License:
|
|
8
|
+
License: CC-BY-4.0
|
|
9
9
|
Keywords: tagscript,string-templating,discord.py
|
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: Freely Distributable
|
|
13
12
|
Classifier: Natural Language :: English
|
|
14
13
|
Classifier: Operating System :: OS Independent
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -41,7 +40,7 @@ Dynamic: license-file
|
|
|
41
40
|
<img src="https://img.shields.io/pypi/v/AdvancedTagScript" alt="PyPI - Version">
|
|
42
41
|
</a>
|
|
43
42
|
<a href="https://advancedtagscript.readthedocs.io/en/latest/?badge=latest">
|
|
44
|
-
<img src="https://readthedocs.org/projects/
|
|
43
|
+
<img src="https://readthedocs.org/projects/AdvancedTagScript/badge/?version=latest" alt="Documentation Status" />
|
|
45
44
|
</a>
|
|
46
45
|
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
47
46
|
<img src="https://img.shields.io/pypi/dm/AdvancedTagScript" alt="PyPI - Downloads" />
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<img src="https://img.shields.io/pypi/v/AdvancedTagScript" alt="PyPI - Version">
|
|
7
7
|
</a>
|
|
8
8
|
<a href="https://advancedtagscript.readthedocs.io/en/latest/?badge=latest">
|
|
9
|
-
<img src="https://readthedocs.org/projects/
|
|
9
|
+
<img src="https://readthedocs.org/projects/AdvancedTagScript/badge/?version=latest" alt="Documentation Status" />
|
|
10
10
|
</a>
|
|
11
11
|
<a href="https://pypi.python.org/pypi/AdvancedTagScript/">
|
|
12
12
|
<img src="https://img.shields.io/pypi/dm/AdvancedTagScript" alt="PyPI - Downloads" />
|
|
@@ -24,6 +24,7 @@ from .block import (
|
|
|
24
24
|
helper_parse_if as helper_parse_if,
|
|
25
25
|
helper_parse_list_if as helper_parse_list_if,
|
|
26
26
|
helper_split as helper_split,
|
|
27
|
+
easier_helper_split as easier_helper_split,
|
|
27
28
|
AllowedMentionsBlock as AllowedMentionsBlock,
|
|
28
29
|
AllBlock as AllBlock,
|
|
29
30
|
AnyBlock as AnyBlock,
|
|
@@ -55,6 +56,8 @@ from .block import (
|
|
|
55
56
|
CountBlock as CountBlock,
|
|
56
57
|
LengthBlock as LengthBlock,
|
|
57
58
|
CooldownBlock as CooldownBlock,
|
|
59
|
+
JoinBlock as JoinBlock,
|
|
60
|
+
|
|
58
61
|
)
|
|
59
62
|
from .interface import (
|
|
60
63
|
Adapter as Adapter,
|
|
@@ -97,6 +100,8 @@ __all__: Tuple[str, ...] = (
|
|
|
97
100
|
"helper_parse_if",
|
|
98
101
|
"helper_parse_list_if",
|
|
99
102
|
"helper_split",
|
|
103
|
+
"easier_helper_split",
|
|
104
|
+
"AllowedMentionsBlock",
|
|
100
105
|
"AllBlock",
|
|
101
106
|
"AnyBlock",
|
|
102
107
|
"AssignmentBlock",
|
|
@@ -127,6 +132,8 @@ __all__: Tuple[str, ...] = (
|
|
|
127
132
|
"LowerBlock",
|
|
128
133
|
"CountBlock",
|
|
129
134
|
"LengthBlock",
|
|
135
|
+
"JoinBlock",
|
|
136
|
+
|
|
130
137
|
"SafeObjectAdapter",
|
|
131
138
|
"StringAdapter",
|
|
132
139
|
"IntAdapter",
|
|
@@ -170,7 +177,7 @@ __all__: Tuple[str, ...] = (
|
|
|
170
177
|
)
|
|
171
178
|
|
|
172
179
|
|
|
173
|
-
__version__: Final[str] = "3.2.
|
|
180
|
+
__version__: Final[str] = "3.2.5"
|
|
174
181
|
|
|
175
182
|
|
|
176
183
|
class VersionNamedTuple(NamedTuple):
|
|
@@ -89,6 +89,9 @@ from .count import (
|
|
|
89
89
|
CountBlock as CountBlock,
|
|
90
90
|
LengthBlock as LengthBlock,
|
|
91
91
|
)
|
|
92
|
+
from .joinblock import (
|
|
93
|
+
JoinBlock as JoinBlock,
|
|
94
|
+
)
|
|
92
95
|
|
|
93
96
|
__all__: Tuple[str, ...] = (
|
|
94
97
|
"implicit_bool",
|
|
@@ -127,4 +130,5 @@ __all__: Tuple[str, ...] = (
|
|
|
127
130
|
"LowerBlock",
|
|
128
131
|
"CountBlock",
|
|
129
132
|
"LengthBlock",
|
|
133
|
+
"JoinBlock",
|
|
130
134
|
)
|
|
@@ -12,7 +12,7 @@ __all__: Tuple[str, ...] = ("UpperBlock", "LowerBlock")
|
|
|
12
12
|
class UpperBlock(Block):
|
|
13
13
|
"""Converts the given text to uppercase.
|
|
14
14
|
|
|
15
|
-
**Usage:** ``{upper([text])
|
|
15
|
+
**Usage:** ``{upper([text])}``
|
|
16
16
|
|
|
17
17
|
**Aliases:** ``uppercase, upper``
|
|
18
18
|
|
|
@@ -22,10 +22,10 @@ class UpperBlock(Block):
|
|
|
22
22
|
|
|
23
23
|
**Examples:** ::
|
|
24
24
|
|
|
25
|
-
The text is {
|
|
25
|
+
The text is {upper(ThIs Is A TeXt)}!
|
|
26
26
|
# The text is THIS IS A TEXT!
|
|
27
27
|
|
|
28
|
-
You have entered {
|
|
28
|
+
You have entered {upper({args})}!
|
|
29
29
|
# You have entered HELLO WORLD!
|
|
30
30
|
"""
|
|
31
31
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Optional, Tuple, cast
|
|
4
|
+
|
|
5
|
+
from ..interface import verb_required_block
|
|
6
|
+
from ..interpreter import Context
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
__all__: Tuple[str, ...] = ("CountBlock", "LengthBlock")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CountBlock(verb_required_block(True, payload=True)): # type: ignore
|
|
13
|
+
"""
|
|
14
|
+
The count block counts occurrences of a substring within a message.
|
|
15
|
+
The search is case sensitive and includes overlapping substrings.
|
|
16
|
+
|
|
17
|
+
A payload (the message to search in) is **required**. Optionally,
|
|
18
|
+
pass the text to search for as a parameter. If no parameter is
|
|
19
|
+
provided, the block counts the number of words in the message
|
|
20
|
+
(spaces + 1).
|
|
21
|
+
|
|
22
|
+
**Usage:** ``{count([text]):<message>}``
|
|
23
|
+
|
|
24
|
+
**Aliases:** ``None``
|
|
25
|
+
|
|
26
|
+
**Payload:** ``message`` (required)
|
|
27
|
+
|
|
28
|
+
**Parameter:** ``text`` (optional, the substring to count)
|
|
29
|
+
|
|
30
|
+
**Examples:** ::
|
|
31
|
+
|
|
32
|
+
{count(Tag):TagScriptEngine}
|
|
33
|
+
# 1
|
|
34
|
+
|
|
35
|
+
{count(Tag):Tag Script Engine TagScriptEngine}
|
|
36
|
+
# 2
|
|
37
|
+
|
|
38
|
+
{count:hello world}
|
|
39
|
+
# 2 (word count: 1 space + 1)
|
|
40
|
+
|
|
41
|
+
{count(123)}
|
|
42
|
+
# Returns {count(123)} — rejected because no payload was provided
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
ACCEPTED_NAMES: Tuple[str, ...] = ("count",)
|
|
46
|
+
|
|
47
|
+
def process(self, ctx: Context) -> Optional[str]:
|
|
48
|
+
if ctx.verb.parameter:
|
|
49
|
+
payload: str = cast(str, ctx.verb.payload)
|
|
50
|
+
return str(payload.count(ctx.verb.parameter))
|
|
51
|
+
return str(cast(str, ctx.verb.payload).count(" ") + 1)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class LengthBlock(verb_required_block(True, parameter=True)): # type: ignore
|
|
55
|
+
"""
|
|
56
|
+
The length block returns the character count of the given text.
|
|
57
|
+
|
|
58
|
+
**Usage:** ``{length(<text>)}``
|
|
59
|
+
|
|
60
|
+
**Aliases:** ``len``
|
|
61
|
+
|
|
62
|
+
**Payload:** ``None``
|
|
63
|
+
|
|
64
|
+
**Parameter:** ``text`` (required)
|
|
65
|
+
|
|
66
|
+
**Examples:** ::
|
|
67
|
+
|
|
68
|
+
{len(TagScriptEngine)}
|
|
69
|
+
# 15
|
|
70
|
+
|
|
71
|
+
{len(hello world)}
|
|
72
|
+
# 11
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
ACCEPTED_NAMES: Tuple[str, ...] = ("length", "len")
|
|
76
|
+
|
|
77
|
+
def process(self, ctx: Context) -> Optional[str]:
|
|
78
|
+
return str(len(ctx.verb.parameter)) if ctx.verb.parameter else "-1"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Optional, Tuple, cast
|
|
4
|
+
|
|
5
|
+
from ..interface import verb_required_block
|
|
6
|
+
from ..interpreter import Context
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
__all__: Tuple[str, ...] = ("JoinBlock",)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class JoinBlock(verb_required_block(False, payload=True, parameter=True)): # type: ignore
|
|
13
|
+
"""
|
|
14
|
+
The join block replaces every space in the payload with the parameter string.
|
|
15
|
+
These blocks only function in Tags.
|
|
16
|
+
|
|
17
|
+
The parameter must be set, even if it is an empty string.
|
|
18
|
+
Cannot use the symbols ``)`` or ``}`` as parameters.
|
|
19
|
+
|
|
20
|
+
**Usage:** ``{join(<string>):<payload>}``
|
|
21
|
+
|
|
22
|
+
**Aliases:** ``None``
|
|
23
|
+
|
|
24
|
+
**Payload:** payload
|
|
25
|
+
|
|
26
|
+
**Parameter:** string (required, can be empty)
|
|
27
|
+
|
|
28
|
+
**Examples:** ::
|
|
29
|
+
|
|
30
|
+
{join(_):hello friends}
|
|
31
|
+
# hello_friends
|
|
32
|
+
|
|
33
|
+
{join():an example sentence}
|
|
34
|
+
# anexamplesentence
|
|
35
|
+
|
|
36
|
+
{join(-):one two three}
|
|
37
|
+
# one-two-three
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
ACCEPTED_NAMES: Tuple[str, ...] = ("join",)
|
|
41
|
+
|
|
42
|
+
def process(self, ctx: Context) -> Optional[str]:
|
|
43
|
+
return cast(str, ctx.verb.payload).replace(" ", cast(str, ctx.verb.parameter))
|
|
@@ -53,16 +53,19 @@ class PythonBlock(verb_required_block(True, payload=True, parameter=True)): # t
|
|
|
53
53
|
|
|
54
54
|
The ``in`` alias checks if the parameter is anywhere in the payload.
|
|
55
55
|
|
|
56
|
-
``
|
|
56
|
+
The ``contains`` alias strictly checks if the parameter is in the payload, split by whitespace.
|
|
57
57
|
|
|
58
|
-
``index`` finds the location of the parameter in the payload, split by whitespace.
|
|
59
|
-
If the parameter string is not found in the payload, it returns 1.
|
|
58
|
+
The ``index`` alias finds the location/index of the parameter in the payload, split by whitespace.
|
|
59
|
+
If the parameter string is not found in the payload, it returns -1.
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
.. note::
|
|
62
|
+
|
|
63
|
+
Both ``contains`` and ``index`` perform **exact** matching on whitespace-split words.
|
|
64
|
+
For example, ``food`` will **not** match ``food.`` (with trailing punctuation).
|
|
62
65
|
|
|
63
66
|
**Usage:** ``{in(<string>):<payload>}``
|
|
64
67
|
|
|
65
|
-
**Aliases:** ``
|
|
68
|
+
**Aliases:** ``in``, ``contains``, ``index``
|
|
66
69
|
|
|
67
70
|
**Payload:** payload
|
|
68
71
|
|
|
@@ -80,12 +83,16 @@ class PythonBlock(verb_required_block(True, payload=True, parameter=True)): # t
|
|
|
80
83
|
{contains(mute):How does it feel to be muted?}
|
|
81
84
|
# false
|
|
82
85
|
{contains(muted?):How does it feel to be muted?}
|
|
83
|
-
#
|
|
86
|
+
# true
|
|
84
87
|
|
|
85
88
|
{index(food):I love to eat food. everyone does.}
|
|
86
|
-
#
|
|
87
|
-
{index(
|
|
88
|
-
#
|
|
89
|
+
# -1 # because of the period. "food" != "food."
|
|
90
|
+
{index(food):I love to eat food everyone does}
|
|
91
|
+
# 4 # because "food" is the 4th word in the payload
|
|
92
|
+
{index(love):I love to eat food}
|
|
93
|
+
# 1 # because "love" is the 2nd word in the payload
|
|
94
|
+
{index(pie):I love to eat food}
|
|
95
|
+
# -1 # because "pie" is not in the payload
|
|
89
96
|
"""
|
|
90
97
|
|
|
91
98
|
def will_accept(self, ctx: Context) -> bool: # type: ignore
|
|
@@ -16,7 +16,7 @@ class StrfBlock(Block):
|
|
|
16
16
|
Two types of timestamps are supported: ISO and epoch.
|
|
17
17
|
If a timestamp isn't passed, the current UTC time is used.
|
|
18
18
|
|
|
19
|
-
Invoking this block with
|
|
19
|
+
Invoking this block with ``unix`` will return the current Unix timestamp.
|
|
20
20
|
|
|
21
21
|
**Usage:** ``{strf([timestamp]):<format>}``
|
|
22
22
|
|
|
@@ -30,8 +30,8 @@ class URLEncodeBlock(verb_required_block(True, payload=True)): # type: ignore
|
|
|
30
30
|
|
|
31
31
|
# the following tagscript can be used to search up tag blocks
|
|
32
32
|
# assume {args} = "command block"
|
|
33
|
-
# <https://
|
|
34
|
-
# <https://
|
|
33
|
+
# <https://cool-cogs.readthedocs.io/en/latest/search.html?q={urlencode(+):{args}}&check_keywords=yes&area=default>
|
|
34
|
+
# <https://cool-cogs.readthedocs.io/en/latest/search.html?q=command+block&check_keywords=yes&area=default>
|
|
35
35
|
"""
|
|
36
36
|
|
|
37
37
|
ACCEPTED_NAMES: Tuple[str, ...] = ("urlencode",)
|
|
@@ -7,7 +7,6 @@ author_email = coolaid@duskybot.xyz
|
|
|
7
7
|
classifiers =
|
|
8
8
|
Development Status :: 5 - Production/Stable
|
|
9
9
|
Intended Audience :: Developers
|
|
10
|
-
License :: Freely Distributable
|
|
11
10
|
Natural Language :: English
|
|
12
11
|
Operating System :: OS Independent
|
|
13
12
|
Programming Language :: Python :: 3.8
|
|
@@ -19,7 +18,7 @@ classifiers =
|
|
|
19
18
|
Topic :: Software Development :: Libraries :: Python Modules
|
|
20
19
|
Topic :: Utilities
|
|
21
20
|
Typing :: Typed
|
|
22
|
-
license =
|
|
21
|
+
license = CC-BY-4.0
|
|
23
22
|
license_file = LICENSE
|
|
24
23
|
description = An easy drop in user-provided Templating system.
|
|
25
24
|
long_description = file: README.md
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
from typing import Optional, Tuple
|
|
2
|
-
from ..interface import Block
|
|
3
|
-
from ..interpreter import Context
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class CommentBlock(Block):
|
|
7
|
-
"""
|
|
8
|
-
The comment block is just for comments, it will not be parsed,
|
|
9
|
-
however it will be removed from your tag's output.
|
|
10
|
-
|
|
11
|
-
**Usage:** ``{comment([other]):[text]}``
|
|
12
|
-
|
|
13
|
-
**Aliases:** /, Comment, comment, //, #
|
|
14
|
-
|
|
15
|
-
**Payload:** ``text``
|
|
16
|
-
|
|
17
|
-
**Parameter:** ``other``
|
|
18
|
-
|
|
19
|
-
.. tagscript::
|
|
20
|
-
|
|
21
|
-
{#:Comment!}
|
|
22
|
-
|
|
23
|
-
{Comment(Something):Comment!}
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
ACCEPTED_NAMES: Tuple[str, ...] = ("/", "Comment", "comment", "//", "#")
|
|
27
|
-
|
|
28
|
-
def process(self, ctx: Context) -> Optional[str]:
|
|
29
|
-
return ""
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Optional, Tuple, cast
|
|
4
|
-
|
|
5
|
-
from ..interface import verb_required_block
|
|
6
|
-
from ..interpreter import Context
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__all__: Tuple[str, ...] = ("CountBlock", "LengthBlock")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class CountBlock(verb_required_block(True, payload=True)): # type: ignore
|
|
13
|
-
"""
|
|
14
|
-
The count block will count how much of text is in message.
|
|
15
|
-
This is case sensitive and will include substrings, if you
|
|
16
|
-
don't provide a parameter, it will count the spaces in the
|
|
17
|
-
message.
|
|
18
|
-
|
|
19
|
-
**Usage:** ``{count([text]):<message>}``
|
|
20
|
-
|
|
21
|
-
**Aliases:** ``None``
|
|
22
|
-
|
|
23
|
-
**Payload:** ``message``
|
|
24
|
-
|
|
25
|
-
**Parameter:** text
|
|
26
|
-
|
|
27
|
-
.. tagscript::
|
|
28
|
-
{count(Tag):TagScriptEngine}
|
|
29
|
-
# 1
|
|
30
|
-
|
|
31
|
-
{count(Tag): Tag Script Engine TagScriptEngine}
|
|
32
|
-
# 2
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
ACCEPTED_NAMES: Tuple[str, ...] = ("count",)
|
|
36
|
-
|
|
37
|
-
def process(self, ctx: Context) -> Optional[str]:
|
|
38
|
-
if ctx.verb.parameter:
|
|
39
|
-
payload: str = cast(str, ctx.verb.payload)
|
|
40
|
-
return str(payload.count(ctx.verb.parameter))
|
|
41
|
-
return str(len(cast(str, ctx.verb.payload)) + 1)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class LengthBlock(verb_required_block(True, payload=True)): # type: ignore
|
|
45
|
-
"""
|
|
46
|
-
The length block will check the length of the given String.
|
|
47
|
-
If a parameter is passed in, the block will check the length
|
|
48
|
-
based on what you passed in, w for word, s for spaces.
|
|
49
|
-
If you provide an invalid parameter, the block will return -1.
|
|
50
|
-
|
|
51
|
-
**Usage:** ``{length(<text>)}``
|
|
52
|
-
|
|
53
|
-
**Aliases:** ``len``
|
|
54
|
-
|
|
55
|
-
**Payload:** None
|
|
56
|
-
|
|
57
|
-
**Parameter:** ``text``
|
|
58
|
-
|
|
59
|
-
.. tagscript::
|
|
60
|
-
|
|
61
|
-
{len("TagScriptEngine")}
|
|
62
|
-
15
|
|
63
|
-
"""
|
|
64
|
-
|
|
65
|
-
ACCEPTED_NAMES: Tuple[str, ...] = ("length", "len")
|
|
66
|
-
|
|
67
|
-
def process(self, ctx: Context) -> Optional[str]:
|
|
68
|
-
return str(len(ctx.verb.parameter)) if ctx.verb.parameter else "-1"
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/AdvancedTagScript.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/AdvancedTagScript.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/discordadapters.py
RENAMED
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/functionadapter.py
RENAMED
|
File without changes
|
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/objectadapter.py
RENAMED
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/redbotadapters.py
RENAMED
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/adapter/stringadapter.py
RENAMED
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/allowedmentions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/loosevariablegetter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/require_blacklist.py
RENAMED
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/shortcutredirect.py
RENAMED
|
File without changes
|
{advancedtagscript-3.2.4 → advancedtagscript-3.2.5}/TagScriptEngine/block/strictvariablegetter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|