dshellInterpreter 0.2.14.4__py3-none-any.whl → 0.2.15.0__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.
- Dshell/DISCORD_COMMANDS/dshell_interaction.py +2 -5
- Dshell/_DshellInterpreteur/dshell_interpreter.py +39 -4
- Dshell/_DshellParser/dshell_parser.py +0 -2
- {dshellinterpreter-0.2.14.4.dist-info → dshellinterpreter-0.2.15.0.dist-info}/METADATA +1 -1
- {dshellinterpreter-0.2.14.4.dist-info → dshellinterpreter-0.2.15.0.dist-info}/RECORD +8 -8
- {dshellinterpreter-0.2.14.4.dist-info → dshellinterpreter-0.2.15.0.dist-info}/WHEEL +0 -0
- {dshellinterpreter-0.2.14.4.dist-info → dshellinterpreter-0.2.15.0.dist-info}/licenses/LICENSE +0 -0
- {dshellinterpreter-0.2.14.4.dist-info → dshellinterpreter-0.2.15.0.dist-info}/top_level.txt +0 -0
|
@@ -64,7 +64,7 @@ async def dshell_respond_interaction(ctx: Interaction,
|
|
|
64
64
|
|
|
65
65
|
return sended_message.id
|
|
66
66
|
|
|
67
|
-
async def dshell_defer_interaction(ctx: Interaction
|
|
67
|
+
async def dshell_defer_interaction(ctx: Interaction) -> bool:
|
|
68
68
|
"""
|
|
69
69
|
Defer a message interaction on Discord
|
|
70
70
|
"""
|
|
@@ -72,10 +72,7 @@ async def dshell_defer_interaction(ctx: Interaction, hide: bool = False) -> bool
|
|
|
72
72
|
if not isinstance(ctx, Interaction):
|
|
73
73
|
raise Exception(f'Respond to an interaction must be used in an interaction context, not {type(ctx)} !')
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
raise Exception(f'Hide parameter must be a boolean, not {type(hide)} !')
|
|
77
|
-
|
|
78
|
-
await ctx.response.defer(ephemeral=hide)
|
|
75
|
+
await ctx.response.defer()
|
|
79
76
|
|
|
80
77
|
return True
|
|
81
78
|
|
|
@@ -139,10 +139,18 @@ class DshellInterpreteur:
|
|
|
139
139
|
self.env[node.name.value] = eval_expression_inline(first_node, self)
|
|
140
140
|
|
|
141
141
|
elif isinstance(first_node, EmbedNode):
|
|
142
|
-
|
|
142
|
+
# rebuild the embed if it already exists
|
|
143
|
+
if node.name.value in self.env and isinstance(self.env[node.name.value], Embed):
|
|
144
|
+
self.env[node.name.value] = rebuild_embed(self.env[node.name.value], first_node.body, first_node.fields, self)
|
|
145
|
+
else:
|
|
146
|
+
self.env[node.name.value] = build_embed(first_node.body, first_node.fields, self)
|
|
143
147
|
|
|
144
148
|
elif isinstance(first_node, PermissionNode):
|
|
145
|
-
|
|
149
|
+
# rebuild the permissions if it already exists
|
|
150
|
+
if node.name.value in self.env and isinstance(self.env[node.name.value], dict):
|
|
151
|
+
self.env[node.name.value].update(build_permission(first_node.body, self))
|
|
152
|
+
else:
|
|
153
|
+
self.env[node.name.value] = build_permission(first_node.body, self)
|
|
146
154
|
|
|
147
155
|
elif isinstance(first_node, UiNode):
|
|
148
156
|
# rebuild the UI if it already exists
|
|
@@ -410,9 +418,9 @@ def length(variable : LengthNode) -> int:
|
|
|
410
418
|
else:
|
|
411
419
|
return len(variable.body.value)
|
|
412
420
|
|
|
413
|
-
def
|
|
421
|
+
def build_embed_args(body: list[Token], fields: list[FieldEmbedNode], interpreter: DshellInterpreteur) -> tuple[dict, list[dict]]:
|
|
414
422
|
"""
|
|
415
|
-
Builds an embed from the command information.
|
|
423
|
+
Builds the arguments for an embed from the command information.
|
|
416
424
|
"""
|
|
417
425
|
args_main_embed: dict[str, list[Any]] = regroupe_commandes(body, interpreter)[0]
|
|
418
426
|
args_main_embed.pop('*') # remove unspecified parameters for the embed
|
|
@@ -430,12 +438,39 @@ def build_embed(body: list[Token], fields: list[FieldEmbedNode], interpreter: Ds
|
|
|
430
438
|
if 'color' in args_main_embed:
|
|
431
439
|
args_main_embed['color'] = build_colour(args_main_embed['color']) # convert color to Colour object or int
|
|
432
440
|
|
|
441
|
+
return args_main_embed, args_fields
|
|
442
|
+
|
|
443
|
+
def build_embed(body: list[Token], fields: list[FieldEmbedNode], interpreter: DshellInterpreteur) -> Embed:
|
|
444
|
+
"""
|
|
445
|
+
Builds an embed from the command information.
|
|
446
|
+
"""
|
|
447
|
+
|
|
448
|
+
args_main_embed, args_fields = build_embed_args(body, fields, interpreter)
|
|
433
449
|
embed = Embed(**args_main_embed) # build the main embed
|
|
434
450
|
for field in args_fields:
|
|
435
451
|
embed.add_field(**field) # add all fields
|
|
436
452
|
|
|
437
453
|
return embed
|
|
438
454
|
|
|
455
|
+
def rebuild_embed(embed: Embed, body: list[Token], fields: list[FieldEmbedNode], interpreter: DshellInterpreteur) -> Embed:
|
|
456
|
+
"""
|
|
457
|
+
Rebuilds an embed from an existing embed and the command information.
|
|
458
|
+
"""
|
|
459
|
+
args_main_embed, args_fields = build_embed_args(body, fields, interpreter)
|
|
460
|
+
|
|
461
|
+
for key, value in args_main_embed.items():
|
|
462
|
+
if key == 'color':
|
|
463
|
+
embed.colour = value
|
|
464
|
+
else:
|
|
465
|
+
setattr(embed, key, value)
|
|
466
|
+
|
|
467
|
+
if args_fields:
|
|
468
|
+
embed.clear_fields()
|
|
469
|
+
for field in args_fields:
|
|
470
|
+
embed.add_field(**field)
|
|
471
|
+
|
|
472
|
+
return embed
|
|
473
|
+
|
|
439
474
|
def build_colour(color: Union[int, ListNode]) -> Union[Colour, int]:
|
|
440
475
|
"""
|
|
441
476
|
Builds a Colour object from an integer or a ListNode.
|
|
@@ -51,8 +51,6 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
|
|
|
51
51
|
last_block = blocks[-1]
|
|
52
52
|
|
|
53
53
|
if first_token_line.type == DTT.COMMAND: # si le token est une comande
|
|
54
|
-
if len(tokens_by_line) <= 1:
|
|
55
|
-
raise Exception(f'[{first_token_line.value.upper()}] take one or more arguments on line {first_token_line.position} !')
|
|
56
54
|
body = tokens_by_line[1:] # on récupère ses arguments
|
|
57
55
|
last_block.body.append(CommandNode(first_token_line.value,
|
|
58
56
|
ArgsCommandNode(body))) # on ajoute la commande au body du dernier bloc
|
|
@@ -2,7 +2,7 @@ Dshell/__init__.py,sha256=pGd94FPy8kVXH_jH566HhApQPhbPfMPnZXzH_0dPWh0,93
|
|
|
2
2
|
Dshell/_utils.py,sha256=PJ3fwn8IMqUMnW9oTwfr9v4--rzHIhhLQoVVqjwjoJU,23
|
|
3
3
|
Dshell/DISCORD_COMMANDS/__init__.py,sha256=87-YpGU74m-m7AqUQni7PGbw73JRlioQkywW_61Whms,208
|
|
4
4
|
Dshell/DISCORD_COMMANDS/dshell_channel.py,sha256=PDXpxrRRWPSucdp_3ITJk0Ur3coneRJKWEl2i7GZ2EM,15696
|
|
5
|
-
Dshell/DISCORD_COMMANDS/dshell_interaction.py,sha256=
|
|
5
|
+
Dshell/DISCORD_COMMANDS/dshell_interaction.py,sha256=5FA8JZ2_v98ZzOZl6EKyjo_fUQC7FuK6C6hij6ZSP30,3495
|
|
6
6
|
Dshell/DISCORD_COMMANDS/dshell_member.py,sha256=5Iw-2dydhYMZOw2nx0svZP9JpZWHOXC0qkL9tClJHtw,8840
|
|
7
7
|
Dshell/DISCORD_COMMANDS/dshell_message.py,sha256=zcWl6Y1W31h9MTHS-j9tLDwcrRiE_wGOu78zu2k0y9I,9101
|
|
8
8
|
Dshell/DISCORD_COMMANDS/dshell_pastbin.py,sha256=H0tUJOwdzYBXvxqipK3mzoNZUKrSLcVm4EZlWbBRScs,796
|
|
@@ -11,16 +11,16 @@ Dshell/DISCORD_COMMANDS/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
|
|
|
11
11
|
Dshell/DISCORD_COMMANDS/utils/utils_message.py,sha256=cQvJ15f49ddOjybARwkJKNFe3ITYQciF-pZHERFPkr0,2964
|
|
12
12
|
Dshell/DISCORD_COMMANDS/utils/utils_thread.py,sha256=tVl4msEwrWHY-0AytI6eY3JSs-eIFUigDSJfK9mT1ww,1457
|
|
13
13
|
Dshell/_DshellInterpreteur/__init__.py,sha256=xy5-J-R3YmY99JF3NBHTRRLsComFxpjnCA5xacISctU,35
|
|
14
|
-
Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=
|
|
14
|
+
Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=dxXhKGCQR8dKSuMRXlWyuBT_ufETdeUao29jNZD-ci4,32429
|
|
15
15
|
Dshell/_DshellParser/__init__.py,sha256=ONDfhZMvClqP_6tE8SLjp-cf3pXL-auQYnfYRrHZxC4,56
|
|
16
16
|
Dshell/_DshellParser/ast_nodes.py,sha256=fU6BVe6w78ZhYib7SGR7iAfTqWqS2kvwZ0d4wMxxOHk,18366
|
|
17
|
-
Dshell/_DshellParser/dshell_parser.py,sha256=
|
|
17
|
+
Dshell/_DshellParser/dshell_parser.py,sha256=YUFfBbFQ1ApOCyVhx-0nJ6S6W5MOBG6YabbkM43BKVw,21708
|
|
18
18
|
Dshell/_DshellTokenizer/__init__.py,sha256=LIQSRhDx2B9pmPx5ADMwwD0Xr9ybneVLhHH8qrJWw_s,172
|
|
19
19
|
Dshell/_DshellTokenizer/dshell_keywords.py,sha256=7oeSKLXCsPRpyU31skCerOUMzd2cdm-GwofpmgTPkD0,5961
|
|
20
20
|
Dshell/_DshellTokenizer/dshell_token_type.py,sha256=gYIb2XN2YcgeRgmar_rBDS5CGmwfmxihu8mOW_d6lbE,1533
|
|
21
21
|
Dshell/_DshellTokenizer/dshell_tokenizer.py,sha256=RrJA2XpcFH2vS6SnRIn5Own_uL5orIDvpq74t8xD3og,7350
|
|
22
|
-
dshellinterpreter-0.2.
|
|
23
|
-
dshellinterpreter-0.2.
|
|
24
|
-
dshellinterpreter-0.2.
|
|
25
|
-
dshellinterpreter-0.2.
|
|
26
|
-
dshellinterpreter-0.2.
|
|
22
|
+
dshellinterpreter-0.2.15.0.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
|
|
23
|
+
dshellinterpreter-0.2.15.0.dist-info/METADATA,sha256=k50VoOmZbcYvsLijpnpLgnjrzsdqfU23BXjnAoN-cQo,1151
|
|
24
|
+
dshellinterpreter-0.2.15.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
25
|
+
dshellinterpreter-0.2.15.0.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
|
|
26
|
+
dshellinterpreter-0.2.15.0.dist-info/RECORD,,
|
|
File without changes
|
{dshellinterpreter-0.2.14.4.dist-info → dshellinterpreter-0.2.15.0.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|