dshellInterpreter 0.2.13.5__py3-none-any.whl → 0.2.13.6__py3-none-any.whl

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.

Potentially problematic release.


This version of dshellInterpreter might be problematic. Click here for more details.

@@ -6,7 +6,7 @@ from string import ascii_letters, digits
6
6
  from copy import deepcopy
7
7
  from pycordViews import SelectMenu, EasyModifiedViews
8
8
 
9
- from discord import AutoShardedBot, Embed, Colour, PermissionOverwrite, Permissions, Guild, Member, Role, Message
9
+ from discord import AutoShardedBot, Embed, Colour, PermissionOverwrite, Permissions, Guild, Member, Role, Message, Interaction, ButtonStyle
10
10
  from discord.ui import Button
11
11
  from discord.abc import PrivateChannel
12
12
 
@@ -20,7 +20,7 @@ from .._DshellTokenizer.dshell_tokenizer import DshellTokenizer
20
20
 
21
21
  All_nodes = TypeVar('All_nodes', IfNode, LoopNode, ElseNode, ElifNode, ArgsCommandNode, VarNode, IdentOperationNode)
22
22
  context = TypeVar('context', AutoShardedBot, Message, PrivateChannel)
23
-
23
+ ButtonStyleValues: tuple = tuple(i.value for i in ButtonStyle)
24
24
 
25
25
  class DshellInterpreteur:
26
26
  """
@@ -425,7 +425,12 @@ def build_ui(ui_node: UiNode, interpreter: DshellInterpreteur) -> EasyModifiedVi
425
425
  for component in ui_node.buttons:
426
426
  args_button: dict[str, list[Any]] = regroupe_commandes(component.body, interpreter, normalise=True)[0]
427
427
  args_button.pop('--*', ())
428
+
428
429
  code = args_button.pop('code', None)
430
+ style = args_button.pop('style', 'grey').upper()
431
+ if style not in ButtonStyleValues:
432
+ raise ValueError(f"Button style must be one of {', '.join(ButtonStyleValues)}, not '{style}' !")
433
+ args_button['style'] = ButtonStyle[style.upper()]
429
434
  args = args_button.pop('*', ())
430
435
  b = Button(*args, **args_button)
431
436
 
@@ -437,7 +442,7 @@ def build_ui(ui_node: UiNode, interpreter: DshellInterpreteur) -> EasyModifiedVi
437
442
 
438
443
  return view
439
444
 
440
- async def ui_button_callback(button, interaction, data):
445
+ async def ui_button_callback(button: Button, interaction: Interaction, data: dict[str, Any]):
441
446
  """
442
447
  Callback for UI buttons.
443
448
  Executes the code associated with the button.
@@ -446,8 +451,8 @@ async def ui_button_callback(button, interaction, data):
446
451
  :param data:
447
452
  :return:
448
453
  """
454
+ print(data)
449
455
  code = data.pop('code', None)
450
- local_env = {}
451
456
  if code is not None:
452
457
  local_env = {
453
458
  '__ret__': None,
@@ -468,9 +473,11 @@ async def ui_button_callback(button, interaction, data):
468
473
  '__private_channel__': isinstance(interaction.channel, PrivateChannel),
469
474
  }
470
475
  local_env.update(data)
471
- x = DshellInterpreteur(code, interaction.message, debug=False)
472
- x.env.update(local_env)
473
- await x.execute()
476
+ x = DshellInterpreteur(code, interaction.message, debug=False)
477
+ x.env.update(local_env)
478
+ await x.execute()
479
+ else:
480
+ await interaction.response.defer(invisible=True)
474
481
 
475
482
  def build_permission(body: list[Token], interpreter: DshellInterpreteur) -> dict[
476
483
  Union[Member, Role], PermissionOverwrite]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 0.2.13.5
3
+ Version: 0.2.13.6
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
@@ -10,7 +10,7 @@ Dshell/DISCORD_COMMANDS/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
10
10
  Dshell/DISCORD_COMMANDS/utils/utils_message.py,sha256=Pn0ljyeCvRfY4tlWHrSbIsxSFZZ5J4lDaeVme3WHp9o,1239
11
11
  Dshell/DISCORD_COMMANDS/utils/utils_thread.py,sha256=tVl4msEwrWHY-0AytI6eY3JSs-eIFUigDSJfK9mT1ww,1457
12
12
  Dshell/_DshellInterpreteur/__init__.py,sha256=xy5-J-R3YmY99JF3NBHTRRLsComFxpjnCA5xacISctU,35
13
- Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=E2NA5SpnbdB-o1MOoP5xUX4rNULLQPIiHk41KCD8XpM,26355
13
+ Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=swzB25XdhT7p3NAQp7zeudSSKZ_22PHBrzH7klja4aM,26831
14
14
  Dshell/_DshellParser/__init__.py,sha256=ONDfhZMvClqP_6tE8SLjp-cf3pXL-auQYnfYRrHZxC4,56
15
15
  Dshell/_DshellParser/ast_nodes.py,sha256=CXUG0rIJNh4jzMCgCcRqmQwU0WQoESQ-5FkuVtZZndM,17717
16
16
  Dshell/_DshellParser/dshell_parser.py,sha256=73eKwY7iBzBtL6n2IxJcvtSz0xkfE5y1qEffZ2YfXXY,16913
@@ -18,8 +18,8 @@ Dshell/_DshellTokenizer/__init__.py,sha256=LIQSRhDx2B9pmPx5ADMwwD0Xr9ybneVLhHH8q
18
18
  Dshell/_DshellTokenizer/dshell_keywords.py,sha256=HtrOQiND_TdM2pdNNAdjBZK2Lhzm2_9umY2dmKfFMTQ,5675
19
19
  Dshell/_DshellTokenizer/dshell_token_type.py,sha256=gYIb2XN2YcgeRgmar_rBDS5CGmwfmxihu8mOW_d6lbE,1533
20
20
  Dshell/_DshellTokenizer/dshell_tokenizer.py,sha256=LZGs4Ytuyx9Galazqtz32lS4Mmu9yZya1B7AzFQAQOk,7150
21
- dshellinterpreter-0.2.13.5.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
22
- dshellinterpreter-0.2.13.5.dist-info/METADATA,sha256=5U40G2EGuFk9mnKAQ9Cd4bfT-MyP2JvX2UEu_g4cSsQ,1151
23
- dshellinterpreter-0.2.13.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
- dshellinterpreter-0.2.13.5.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
25
- dshellinterpreter-0.2.13.5.dist-info/RECORD,,
21
+ dshellinterpreter-0.2.13.6.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
22
+ dshellinterpreter-0.2.13.6.dist-info/METADATA,sha256=vg4tB76gV4toHssMz6FF44V0Kpl7XXYd8viIXsFLFfQ,1151
23
+ dshellinterpreter-0.2.13.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ dshellinterpreter-0.2.13.6.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
25
+ dshellinterpreter-0.2.13.6.dist-info/RECORD,,