dshellInterpreter 0.2.13.4__tar.gz → 0.2.13.6__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.
Potentially problematic release.
This version of dshellInterpreter might be problematic. Click here for more details.
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellInterpreteur/dshell_interpreter.py +22 -7
- {dshellinterpreter-0.2.13.4/dshellInterpreter.egg-info → dshellinterpreter-0.2.13.6}/PKG-INFO +1 -1
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6/dshellInterpreter.egg-info}/PKG-INFO +1 -1
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/setup.py +1 -1
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellInterpreteur/__init__.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellParser/__init__.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellParser/ast_nodes.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellParser/dshell_parser.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellTokenizer/__init__.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellTokenizer/dshell_keywords.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellTokenizer/dshell_token_type.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellTokenizer/dshell_tokenizer.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/__init__.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_utils.py +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/LICENSE +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/README.md +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/dshellInterpreter.egg-info/requires.txt +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/dshellInterpreter.egg-info/top_level.txt +0 -0
- {dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/setup.cfg +0 -0
|
@@ -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,9 +442,17 @@ 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]):
|
|
446
|
+
"""
|
|
447
|
+
Callback for UI buttons.
|
|
448
|
+
Executes the code associated with the button.
|
|
449
|
+
:param button:
|
|
450
|
+
:param interaction:
|
|
451
|
+
:param data:
|
|
452
|
+
:return:
|
|
453
|
+
"""
|
|
454
|
+
print(data)
|
|
441
455
|
code = data.pop('code', None)
|
|
442
|
-
local_env = {}
|
|
443
456
|
if code is not None:
|
|
444
457
|
local_env = {
|
|
445
458
|
'__ret__': None,
|
|
@@ -460,9 +473,11 @@ async def ui_button_callback(button, interaction, data):
|
|
|
460
473
|
'__private_channel__': isinstance(interaction.channel, PrivateChannel),
|
|
461
474
|
}
|
|
462
475
|
local_env.update(data)
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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)
|
|
466
481
|
|
|
467
482
|
def build_permission(body: list[Token], interpreter: DshellInterpreteur) -> dict[
|
|
468
483
|
Union[Member, Role], PermissionOverwrite]:
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="dshellInterpreter",
|
|
8
|
-
version="0.2.13.
|
|
8
|
+
version="0.2.13.6",
|
|
9
9
|
author="Chronos",
|
|
10
10
|
author_email="vagabonwalybi@gmail.com",
|
|
11
11
|
description="A Discord bot interpreter for creating custom commands and automations.",
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_channel.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_member.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_message.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/dshell_role.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/DISCORD_COMMANDS/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellInterpreteur/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellParser/dshell_parser.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellTokenizer/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/Dshell/_DshellTokenizer/dshell_keywords.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/dshellInterpreter.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/dshellInterpreter.egg-info/requires.txt
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.4 → dshellinterpreter-0.2.13.6}/dshellInterpreter.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|