dshellInterpreter 1.2.7.7__tar.gz → 1.2.7.9__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.
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_ui.py +31 -6
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/dshell_interpreter.py +1 -4
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellTokenizer/dshell_keywords.py +0 -3
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/full_import.py +1 -1
- {dshellinterpreter-1.2.7.7/dshellInterpreter.egg-info → dshellinterpreter-1.2.7.9}/PKG-INFO +1 -1
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9/dshellInterpreter.egg-info}/PKG-INFO +1 -1
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/setup.py +1 -1
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_embed.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_file.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_file.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_global.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_list.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_member.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_numbers.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_permissions.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_string.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_type_validation.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/__init__.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/cached_messages.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/dshell_arguments.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/dshell_global_variables.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/dshell_iterators.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/dshell_scope.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/errors.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/utils_interpreter.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellParser/__init__.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellParser/ast_nodes.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellParser/dshell_parser.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellParser/errors.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellPreProcess/__init__.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellPreProcess/dshell_preprocess.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellTokenizer/__init__.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellTokenizer/dshell_token_type.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellTokenizer/dshell_tokenizer.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/__init__.py +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/LICENSE +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/README.md +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/dshellInterpreter.egg-info/requires.txt +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/dshellInterpreter.egg-info/top_level.txt +0 -0
- {dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/setup.cfg +0 -0
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_ui.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from ..full_import import (ButtonStyle,
|
|
2
2
|
PrivateChannel,
|
|
3
3
|
Interaction,
|
|
4
4
|
ui,
|
|
@@ -7,15 +7,16 @@ from Dshell.full_import import (ButtonStyle,
|
|
|
7
7
|
CustomIDNotFound,
|
|
8
8
|
SelectMenu,
|
|
9
9
|
ComponentType,
|
|
10
|
-
random
|
|
10
|
+
random,
|
|
11
|
+
IntEnum)
|
|
11
12
|
|
|
12
13
|
from ..DshellParser.ast_nodes import UiSelectNode, UiButtonNode, OptionUiSelectNode, ListNode, StrNode, IntNode, BoolNode
|
|
13
14
|
|
|
14
15
|
from ..DshellInterpreteur.utils_interpreter import regroupe_commandes
|
|
15
16
|
|
|
16
|
-
from ..DshellInterpreteur.dshell_scope import new_scope,
|
|
17
|
+
from ..DshellInterpreteur.dshell_scope import new_scope, update_nbr_usage_scope
|
|
17
18
|
|
|
18
|
-
from
|
|
19
|
+
from ..full_import import Any, TYPE_CHECKING, Union, Optional
|
|
19
20
|
|
|
20
21
|
from .utils.utils_type_validation import (_validate_optional_code_node,
|
|
21
22
|
_validate_required_int,
|
|
@@ -39,6 +40,22 @@ SelectSyleValues: dict = {'string': ComponentType.string_select,
|
|
|
39
40
|
'mention': ComponentType.mentionable_select,
|
|
40
41
|
'channel': ComponentType.channel_select}
|
|
41
42
|
|
|
43
|
+
class UITimeout(IntEnum):
|
|
44
|
+
default_timeout = 600
|
|
45
|
+
max_timeout = 60*60*24
|
|
46
|
+
min_timeout = 5
|
|
47
|
+
|
|
48
|
+
def check_timeout(timeout: Union[int, IntNode]):
|
|
49
|
+
"""
|
|
50
|
+
Check if the timeout is : min_timeout <= timeout <= max_timeout
|
|
51
|
+
:param timeout:
|
|
52
|
+
:return: the current timeout
|
|
53
|
+
"""
|
|
54
|
+
if not UITimeout.min_timeout <= timeout <= UITimeout.max_timeout:
|
|
55
|
+
raise Exception(f"UI timeout must be greater or equal than [{UITimeout.min_timeout} min] "
|
|
56
|
+
f"and less or equal than[{UITimeout.max_timeout}]")
|
|
57
|
+
return timeout
|
|
58
|
+
|
|
42
59
|
async def build_ui_button_parameters(ui_button_node: UiButtonNode, interpreter: "DshellInterpreteur"):
|
|
43
60
|
"""
|
|
44
61
|
Builds the parameters for a UI component from the UiNode.
|
|
@@ -53,16 +70,18 @@ async def build_ui_button_parameters(ui_button_node: UiButtonNode, interpreter:
|
|
|
53
70
|
args_button: dict[str, list[Any]] = regrouped_parameters.get_dict_parameters()
|
|
54
71
|
|
|
55
72
|
code = args_button.pop('code', None)
|
|
56
|
-
style = StrNode(args_button.pop('style', 'primary').lower())
|
|
73
|
+
style = StrNode(args_button.pop('style', StrNode('primary')).lower())
|
|
57
74
|
custom_id = args_button.pop('custom_id', StrNode('ui_button_'+str(random())))
|
|
58
75
|
row = args_button.pop('row', IntNode(0))
|
|
59
76
|
emoji = utils_refactor_emoji(args_button.pop('emoji', None))
|
|
77
|
+
timeout = args_button.pop('timeout', IntNode(UITimeout.default_timeout))
|
|
60
78
|
|
|
61
79
|
_validate_optional_code_node(code, "code", _CMD)
|
|
62
80
|
_validate_required_string(style, "style", _CMD)
|
|
63
81
|
_validate_required_string(custom_id, "custom_id", _CMD)
|
|
64
82
|
_validate_required_int(row, "row", _CMD)
|
|
65
83
|
_validate_optional_string(emoji, "emoji", _CMD)
|
|
84
|
+
_validate_required_int(timeout, 'timeout', _CMD)
|
|
66
85
|
|
|
67
86
|
if style not in ButtonStyleValues:
|
|
68
87
|
raise ValueError(f"Button style must be one of {', '.join(ButtonStyleValues)}, not '{style}' !")
|
|
@@ -71,6 +90,7 @@ async def build_ui_button_parameters(ui_button_node: UiButtonNode, interpreter:
|
|
|
71
90
|
args_button['row'] = row
|
|
72
91
|
args_button['style'] = ButtonStyle[style]
|
|
73
92
|
args_button['emoji'] = emoji
|
|
93
|
+
args_button['timeout'] = check_timeout(timeout)
|
|
74
94
|
args = args_button.pop('*', ())
|
|
75
95
|
yield args, args_button, code
|
|
76
96
|
|
|
@@ -89,13 +109,14 @@ async def build_ui_select_parameters(ui_select_node: UiSelectNode, interpreter:
|
|
|
89
109
|
|
|
90
110
|
code = args_select.pop('code', None)
|
|
91
111
|
custom_id = args_select.pop('custom_id', StrNode('ui_select_'+str(random())))
|
|
92
|
-
select_type = StrNode(args_select.pop('type', 'string').lower())
|
|
112
|
+
select_type = StrNode(args_select.pop('type', StrNode('string')).lower())
|
|
93
113
|
|
|
94
114
|
disabled = args_select.get('disabled', BoolNode(0))
|
|
95
115
|
max_values = args_select.get('max', IntNode(1))
|
|
96
116
|
min_values = args_select.get('min', IntNode(1))
|
|
97
117
|
placeholder = args_select.get('placeholder', StrNode(""))
|
|
98
118
|
row = args_select.pop('row', IntNode(0))
|
|
119
|
+
timeout = args_select.pop('timeout', IntNode(UITimeout.default_timeout))
|
|
99
120
|
|
|
100
121
|
_validate_optional_code_node(code, "Select code", _CMD)
|
|
101
122
|
_validate_required_string(custom_id, "custom_id", _CMD)
|
|
@@ -105,6 +126,7 @@ async def build_ui_select_parameters(ui_select_node: UiSelectNode, interpreter:
|
|
|
105
126
|
_validate_required_int(max_values, "min", _CMD)
|
|
106
127
|
_validate_required_string(placeholder, "placeholder", _CMD)
|
|
107
128
|
_validate_optional_int(row, "row", _CMD)
|
|
129
|
+
_validate_required_int(timeout, 'timeout', _CMD)
|
|
108
130
|
|
|
109
131
|
if select_type not in SelectSyleValues:
|
|
110
132
|
raise TypeError(f"Select style must be one of {', '.join(SelectSyleValues.keys())}, not '{select_type}' !")
|
|
@@ -117,6 +139,7 @@ async def build_ui_select_parameters(ui_select_node: UiSelectNode, interpreter:
|
|
|
117
139
|
args_select["row"] = row
|
|
118
140
|
args_select["type"] = SelectSyleValues[select_type]
|
|
119
141
|
args_select['custom_id'] = custom_id
|
|
142
|
+
args_select['timeout'] = check_timeout(timeout)
|
|
120
143
|
args = args_select.pop('*', ())
|
|
121
144
|
|
|
122
145
|
yield args, args_select, code
|
|
@@ -185,6 +208,7 @@ async def build_ui(ui_node: Union[UiButtonNode, UiSelectNode], interpreter: "Dsh
|
|
|
185
208
|
|
|
186
209
|
if isinstance(ui_node, UiButtonNode):
|
|
187
210
|
async for _, args_button, code in build_ui_button_parameters(ui_node, interpreter):
|
|
211
|
+
view.timeout = args_button.pop('timeout', UITimeout.default_timeout)
|
|
188
212
|
b = ui.Button(**args_button)
|
|
189
213
|
view.add_items(b)
|
|
190
214
|
view.set_callable(b.custom_id, _callable=ui_button_callback, data={'code': code, scope_id: interpreter.scope_id})
|
|
@@ -196,6 +220,7 @@ async def build_ui(ui_node: Union[UiButtonNode, UiSelectNode], interpreter: "Dsh
|
|
|
196
220
|
|
|
197
221
|
options = args_select.pop("options", [])
|
|
198
222
|
select_type = args_select.pop("type")
|
|
223
|
+
view.timeout = args_select.pop('timeout', IntNode(UITimeout.default_timeout))
|
|
199
224
|
|
|
200
225
|
if select_type == ComponentType.string_select:
|
|
201
226
|
menu = s.add_string_select_menu(**args_select)
|
|
@@ -202,10 +202,7 @@ class DshellInterpreteur:
|
|
|
202
202
|
self.env.set(node.name.value, ListNode([await build_ui(first_node, self)])) # store UIs in a list
|
|
203
203
|
|
|
204
204
|
elif isinstance(first_node, CodeNode):
|
|
205
|
-
|
|
206
|
-
self.env.get(node.name.value).update(first_node)
|
|
207
|
-
else:
|
|
208
|
-
self.env.set(node.name.value, first_node)
|
|
205
|
+
self.env.set(node.name.value, first_node)
|
|
209
206
|
|
|
210
207
|
else:
|
|
211
208
|
self.env.set(node.name.value, await eval_expression(node.body, self))
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellTokenizer/dshell_keywords.py
RENAMED
|
@@ -239,6 +239,3 @@ dshell_operators: ChainMap[str, Operator] = ChainMap(
|
|
|
239
239
|
dshell_logical_word_operators,
|
|
240
240
|
dshell_mathematical_operators)
|
|
241
241
|
|
|
242
|
-
"""dshell_operators: dict[str, tuple[Callable, int, int, int, Optional[int]]] = dshell_logical_operators.copy()
|
|
243
|
-
dshell_operators.update(dshell_logical_word_operators)
|
|
244
|
-
dshell_operators.update(dshell_mathematical_operators)"""
|
|
@@ -13,5 +13,5 @@ from discord.utils import get, _MissingSentinel
|
|
|
13
13
|
from contextvars import ContextVar
|
|
14
14
|
from re import *
|
|
15
15
|
from random import randint, choice, random
|
|
16
|
-
from enum import Enum, auto, StrEnum
|
|
16
|
+
from enum import Enum, auto, StrEnum, IntEnum
|
|
17
17
|
from collections import ChainMap
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="dshellInterpreter",
|
|
8
|
-
version="1.2.7.
|
|
8
|
+
version="1.2.7.9",
|
|
9
9
|
author="Chronos",
|
|
10
10
|
author_email="vagabonwalybi@gmail.com",
|
|
11
11
|
description="A Discord bot interpreter for creating custom commands and automations.",
|
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_channel.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_embed.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_member.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_message.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/dshell_role.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DISCORD_COMMANDS/utils/utils_list.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
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/cached_messages.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellInterpreteur/dshell_scope.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellParser/dshell_parser.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellPreProcess/dshell_preprocess.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellTokenizer/dshell_token_type.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/Dshell/DshellTokenizer/dshell_tokenizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/dshellInterpreter.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/dshellInterpreter.egg-info/requires.txt
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.7 → dshellinterpreter-1.2.7.9}/dshellInterpreter.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|