dshellInterpreter 1.2.1.0__tar.gz → 1.2.1.1__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.
Files changed (53) hide show
  1. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/dshell_ui.py +26 -21
  2. {dshellinterpreter-1.2.1.0/dshellInterpreter.egg-info → dshellinterpreter-1.2.1.1}/PKG-INFO +1 -1
  3. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1/dshellInterpreter.egg-info}/PKG-INFO +1 -1
  4. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/setup.py +1 -1
  5. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
  6. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
  7. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/dshell_embed.py +0 -0
  8. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/dshell_file.py +0 -0
  9. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
  10. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
  11. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
  12. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
  13. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
  14. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
  15. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py +0 -0
  16. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_file.py +0 -0
  17. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_global.py +0 -0
  18. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_list.py +0 -0
  19. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_member.py +0 -0
  20. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
  21. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_numbers.py +0 -0
  22. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_permissions.py +0 -0
  23. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_string.py +0 -0
  24. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
  25. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DISCORD_COMMANDS/utils/utils_type_validation.py +0 -0
  26. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellInterpreteur/__init__.py +0 -0
  27. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellInterpreteur/cached_messages.py +0 -0
  28. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellInterpreteur/dshell_arguments.py +0 -0
  29. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellInterpreteur/dshell_global_variables.py +0 -0
  30. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellInterpreteur/dshell_interpreter.py +0 -0
  31. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellInterpreteur/dshell_scope.py +0 -0
  32. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellInterpreteur/errors.py +0 -0
  33. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellInterpreteur/utils_interpreter.py +0 -0
  34. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellParser/__init__.py +0 -0
  35. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellParser/ast_nodes.py +0 -0
  36. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellParser/dshell_parser.py +0 -0
  37. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellParser/errors.py +0 -0
  38. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellPreProcess/__init__.py +0 -0
  39. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellPreProcess/dshell_preprocess.py +0 -0
  40. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellTokenizer/__init__.py +0 -0
  41. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellTokenizer/dshell_keywords.py +0 -0
  42. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellTokenizer/dshell_token_type.py +0 -0
  43. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/DshellTokenizer/dshell_tokenizer.py +0 -0
  44. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/__init__.py +0 -0
  45. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/full_import.py +0 -0
  46. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/Dshell/regex_test.py +0 -0
  47. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/LICENSE +0 -0
  48. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/README.md +0 -0
  49. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
  50. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
  51. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/dshellInterpreter.egg-info/requires.txt +0 -0
  52. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/dshellInterpreter.egg-info/top_level.txt +0 -0
  53. {dshellinterpreter-1.2.1.0 → dshellinterpreter-1.2.1.1}/setup.cfg +0 -0
@@ -47,18 +47,24 @@ async def build_ui_button_parameters(ui_button_node: UiButtonNode, interpreter:
47
47
 
48
48
  code = args_button.pop('code', None)
49
49
  style = args_button.pop('style', 'primary').lower()
50
- custom_id = args_button.pop('custom_id', 'ui_button_'+str(random()))
51
- row = args_button.pop('row', 0)
50
+ custom_id = args_button.pop('custom_id', StrNode('ui_button_'+str(random())))
51
+ row = args_button.pop('row', IntNode(0))
52
52
  emoji = utils_refactor_emoji(args_button.pop('emoji', None))
53
53
 
54
54
  _validate_optional_code_node(code, "Button code", "build_ui_button")
55
55
 
56
- if not isinstance(custom_id, str):
56
+ if not isinstance(custom_id, StrNode):
57
57
  raise TypeError(f"Button custom_id must be a string, not {type(custom_id)} !")
58
58
 
59
59
  if style not in ButtonStyleValues:
60
60
  raise ValueError(f"Button style must be one of {', '.join(ButtonStyleValues)}, not '{style}' !")
61
61
 
62
+ if not isinstance(row, IntNode):
63
+ raise TypeError(f"Buttton row must be a int, not {type(row)} !")
64
+
65
+ if not isinstance(emoji, StrNode):
66
+ raise TypeError(f"Button emoji must be a str, not {type(emoji)} !")
67
+
62
68
  args_button['custom_id'] = custom_id
63
69
  args_button['row'] = row
64
70
  args_button['style'] = ButtonStyle[style]
@@ -78,7 +84,7 @@ async def build_ui_select_parameters(ui_select_node: UiSelectNode, interpreter:
78
84
  args_select: dict[str, list[Any]] = regrouped_parameters.get_dict_parameters()
79
85
 
80
86
  code = args_select.pop('code', None)
81
- custom_id = args_select.pop('custom_id', 'ui_select_'+str(random()))
87
+ custom_id = args_select.pop('custom_id', StrNode('ui_select_'+str(random())))
82
88
  select_type = args_select.pop('type', 'string').lower()
83
89
 
84
90
  disabled = args_select.get('disabled', False)
@@ -89,22 +95,22 @@ async def build_ui_select_parameters(ui_select_node: UiSelectNode, interpreter:
89
95
 
90
96
  _validate_optional_code_node(code, "Select code", "build_ui_select")
91
97
 
92
- if not isinstance(custom_id, str):
98
+ if not isinstance(custom_id, StrNode):
93
99
  raise TypeError(f"Select custom_id must be a string, not {type(custom_id)} !")
94
100
 
95
- if select_type is None or not isinstance(select_type, str) or select_type not in SelectSyleValues:
101
+ if select_type is None or not isinstance(select_type, StrNode) or select_type not in SelectSyleValues:
96
102
  raise TypeError(f"Select type must be a string, not {type(select_type)} !")
97
103
 
98
- if not isinstance(disabled, bool):
104
+ if not isinstance(disabled, BoolNode):
99
105
  raise TypeError(f"Select disabled must be a bool, not {type(disabled)} !")
100
106
 
101
- if not isinstance(max_values, int):
107
+ if not isinstance(max_values, IntNode):
102
108
  raise TypeError(f"Select max_values must be an int, not {type(max_values)} !")
103
109
 
104
- if not isinstance(min_values, int):
110
+ if not isinstance(min_values, IntNode):
105
111
  raise TypeError(f"Select min_values must be an int, not {type(min_values)} !")
106
112
 
107
- if not isinstance(placeholder, str):
113
+ if not isinstance(placeholder, StrNode):
108
114
  raise TypeError(f"Select placeholder must be a string, not {type(placeholder)} !")
109
115
 
110
116
  _validate_optional_int(row, "Select row", "build_ui_select")
@@ -186,7 +192,6 @@ async def build_ui(ui_node: Union[UiButtonNode, UiSelectNode], interpreter: "Dsh
186
192
 
187
193
  if isinstance(ui_node, UiButtonNode):
188
194
  async for _, args_button, code in build_ui_button_parameters(ui_node, interpreter):
189
- print(args_button)
190
195
  b = ui.Button(**args_button)
191
196
  view.add_items(b)
192
197
  view.set_callable(b.custom_id, _callable=ui_button_callback, data={'code': code, 'interpreter': interpreter})
@@ -288,8 +293,8 @@ async def ui_button_callback(button: ui.Button, interaction: Interaction, data:
288
293
  :param data:
289
294
  :return:
290
295
  """
291
- code = data.pop('code', None)
292
- interpreter: "DshellInterpreteur" = data.pop('interpreter', None)
296
+ code = data.get('code', None)
297
+ interpreter: "DshellInterpreteur" = data.get('interpreter', None)
293
298
  if code is not None:
294
299
  message = interaction
295
300
  local_env = {
@@ -377,14 +382,16 @@ async def ui_button_callback(button: ui.Button, interaction: Interaction, data:
377
382
  }
378
383
  )
379
384
 
380
- local_env.update(data)
385
+ #local_env.update(data)
381
386
  from ..DshellInterpreteur.dshell_interpreter import DshellInterpreteur
382
- with new_scope(interpreter, local_env):
383
- await DshellInterpreteur(code, ctx=interaction, debug=False, vars_env=interpreter.env).execute()
387
+
388
+ new_interpreter = DshellInterpreteur(code, ctx=interaction, debug=False, vars_env=interpreter.env)
389
+ with new_scope(new_interpreter, local_env):
390
+ await new_interpreter.execute()
391
+
384
392
  else:
385
393
  await interaction.response.defer(invisible=True)
386
394
 
387
- data.update({'code': code, 'interpreter': interpreter})
388
395
 
389
396
  async def ui_select_callback(select: ui.Select, interaction: Interaction, data: dict[str, Any]):
390
397
  """
@@ -395,8 +402,8 @@ async def ui_select_callback(select: ui.Select, interaction: Interaction, data:
395
402
  :param data:
396
403
  :return:
397
404
  """
398
- code = data.pop('code', None)
399
- interpreter: "DshellInterpreteur" = data.pop('interpreter', None)
405
+ code = data.get('code', None)
406
+ interpreter: "DshellInterpreteur" = data.get('interpreter', None)
400
407
 
401
408
  message = interaction
402
409
  if code is not None:
@@ -515,5 +522,3 @@ async def ui_select_callback(select: ui.Select, interaction: Interaction, data:
515
522
  await DshellInterpreteur(code, ctx=interaction, debug=False, vars_env=interpreter.env).execute()
516
523
  else:
517
524
  await interaction.response.defer(invisible=True)
518
-
519
- data.update({'code': code, 'interpreter': interpreter})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 1.2.1.0
3
+ Version: 1.2.1.1
4
4
  Summary: A Discord bot interpreter for creating custom commands and automations.
5
5
  Home-page: https://github.com/BOXERRMD/Dshell_Interpreter
6
6
  Author: Chronos
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 1.2.1.0
3
+ Version: 1.2.1.1
4
4
  Summary: A Discord bot interpreter for creating custom commands and automations.
5
5
  Home-page: https://github.com/BOXERRMD/Dshell_Interpreter
6
6
  Author: Chronos
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name="dshellInterpreter",
8
- version="1.2.1.0",
8
+ version="1.2.1.1",
9
9
  author="Chronos",
10
10
  author_email="vagabonwalybi@gmail.com",
11
11
  description="A Discord bot interpreter for creating custom commands and automations.",