dshellInterpreter 0.2.13.8__py3-none-any.whl → 0.2.13.10__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_message.py +49 -8
- Dshell/_DshellInterpreteur/dshell_interpreter.py +4 -2
- Dshell/_DshellTokenizer/dshell_keywords.py +1 -0
- {dshellinterpreter-0.2.13.8.dist-info → dshellinterpreter-0.2.13.10.dist-info}/METADATA +1 -1
- {dshellinterpreter-0.2.13.8.dist-info → dshellinterpreter-0.2.13.10.dist-info}/RECORD +8 -8
- {dshellinterpreter-0.2.13.8.dist-info → dshellinterpreter-0.2.13.10.dist-info}/WHEEL +0 -0
- {dshellinterpreter-0.2.13.8.dist-info → dshellinterpreter-0.2.13.10.dist-info}/licenses/LICENSE +0 -0
- {dshellinterpreter-0.2.13.8.dist-info → dshellinterpreter-0.2.13.10.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
from re import search
|
|
2
2
|
|
|
3
|
-
from discord import Embed, Message
|
|
3
|
+
from discord import Embed, Message, Interaction
|
|
4
4
|
from discord.ext import commands
|
|
5
|
-
from discord.abc import Messageable
|
|
6
5
|
|
|
7
6
|
from pycordViews import EasyModifiedViews
|
|
8
7
|
|
|
@@ -12,6 +11,7 @@ from .._utils import NoneType
|
|
|
12
11
|
__all__ = [
|
|
13
12
|
'dshell_send_message',
|
|
14
13
|
'dshell_respond_message',
|
|
14
|
+
'dshell_respond_interaction',
|
|
15
15
|
'dshell_delete_message',
|
|
16
16
|
'dshell_purge_message',
|
|
17
17
|
'dshell_edit_message',
|
|
@@ -42,7 +42,10 @@ async def dshell_send_message(ctx: Message, message=None, delete=None, channel=N
|
|
|
42
42
|
if not isinstance(embeds, (ListNode, Embed, NoneType)):
|
|
43
43
|
raise Exception(f'Embeds must be a list of Embed objects or a single Embed object, not {type(embeds)} !')
|
|
44
44
|
|
|
45
|
-
if
|
|
45
|
+
if embeds is None:
|
|
46
|
+
embeds = ListNode([])
|
|
47
|
+
|
|
48
|
+
elif isinstance(embeds, Embed):
|
|
46
49
|
embeds = ListNode([embeds])
|
|
47
50
|
|
|
48
51
|
if not isinstance(view, (EasyModifiedViews, NoneType)):
|
|
@@ -68,15 +71,15 @@ async def dshell_respond_message(ctx: Message, message=None, content: str = None
|
|
|
68
71
|
|
|
69
72
|
from .._DshellParser.ast_nodes import ListNode
|
|
70
73
|
|
|
74
|
+
if not isinstance(embeds, (ListNode, Embed, NoneType)):
|
|
75
|
+
raise Exception(f'Embeds must be a list of Embed objects or a single Embed object, not {type(embeds)} !')
|
|
76
|
+
|
|
71
77
|
if embeds is None:
|
|
72
78
|
embeds = ListNode([])
|
|
73
79
|
|
|
74
80
|
elif isinstance(embeds, Embed):
|
|
75
81
|
embeds = ListNode([embeds])
|
|
76
82
|
|
|
77
|
-
else:
|
|
78
|
-
raise Exception(f'Embeds must be a list of Embed objects or a single Embed object, not {type(embeds)} !')
|
|
79
|
-
|
|
80
83
|
sended_message = await respond_message.reply(
|
|
81
84
|
content=str(content),
|
|
82
85
|
mention_author=mention_author,
|
|
@@ -85,6 +88,39 @@ async def dshell_respond_message(ctx: Message, message=None, content: str = None
|
|
|
85
88
|
|
|
86
89
|
return sended_message.id
|
|
87
90
|
|
|
91
|
+
async def dshell_respond_interaction(ctx: Interaction, content: str = None, delete=None, mention: bool = None, embeds=None, view=None):
|
|
92
|
+
"""
|
|
93
|
+
Responds to a message interaction on Discord
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
if delete is not None and not isinstance(delete, (int, float)):
|
|
97
|
+
raise Exception(f'Delete parameter must be a number (seconds) or None, not {type(delete)} !')
|
|
98
|
+
|
|
99
|
+
mention_author = mention if mention is not None else False
|
|
100
|
+
|
|
101
|
+
from .._DshellParser.ast_nodes import ListNode
|
|
102
|
+
|
|
103
|
+
if not isinstance(embeds, (ListNode, Embed, NoneType)):
|
|
104
|
+
raise Exception(f'Embeds must be a list of Embed objects or a single Embed object, not {type(embeds)} !')
|
|
105
|
+
|
|
106
|
+
if embeds is None:
|
|
107
|
+
embeds = ListNode([])
|
|
108
|
+
|
|
109
|
+
elif isinstance(embeds, Embed):
|
|
110
|
+
embeds = ListNode([embeds])
|
|
111
|
+
|
|
112
|
+
if not isinstance(view, (EasyModifiedViews, NoneType)):
|
|
113
|
+
raise Exception(f'Channel must be an UI or None, not {type(view)} !')
|
|
114
|
+
|
|
115
|
+
sended_message = await ctx.response.send_message(
|
|
116
|
+
content=str(content),
|
|
117
|
+
ephemeral=not mention_author,
|
|
118
|
+
delete_after=delete,
|
|
119
|
+
embeds=embeds,
|
|
120
|
+
view=view)
|
|
121
|
+
|
|
122
|
+
return sended_message.id
|
|
123
|
+
|
|
88
124
|
async def dshell_delete_message(ctx: Message, message=None, reason=None, delay=0):
|
|
89
125
|
"""
|
|
90
126
|
Deletes a message
|
|
@@ -123,11 +159,16 @@ async def dshell_edit_message(ctx: Message, message, new_content=None, embeds=No
|
|
|
123
159
|
"""
|
|
124
160
|
edit_message = utils_get_message(ctx, message)
|
|
125
161
|
|
|
162
|
+
from .._DshellParser.ast_nodes import ListNode
|
|
163
|
+
|
|
164
|
+
if not isinstance(embeds, (ListNode, Embed, NoneType)):
|
|
165
|
+
raise Exception(f'Embeds must be a list of Embed objects or a single Embed object, not {type(embeds)} !')
|
|
166
|
+
|
|
126
167
|
if embeds is None:
|
|
127
|
-
embeds = []
|
|
168
|
+
embeds = ListNode([])
|
|
128
169
|
|
|
129
170
|
elif isinstance(embeds, Embed):
|
|
130
|
-
embeds = [embeds]
|
|
171
|
+
embeds = ListNode([embeds])
|
|
131
172
|
|
|
132
173
|
await edit_message.edit(content=new_content, embeds=embeds)
|
|
133
174
|
|
|
@@ -19,7 +19,7 @@ from .._DshellTokenizer.dshell_token_type import Token
|
|
|
19
19
|
from .._DshellTokenizer.dshell_tokenizer import DshellTokenizer
|
|
20
20
|
|
|
21
21
|
All_nodes = TypeVar('All_nodes', IfNode, LoopNode, ElseNode, ElifNode, ArgsCommandNode, VarNode, IdentOperationNode)
|
|
22
|
-
context = TypeVar('context', AutoShardedBot, Message, PrivateChannel)
|
|
22
|
+
context = TypeVar('context', AutoShardedBot, Message, PrivateChannel, Interaction)
|
|
23
23
|
ButtonStyleValues: tuple = tuple(i.name for i in ButtonStyle)
|
|
24
24
|
|
|
25
25
|
class DshellInterpreteur:
|
|
@@ -473,12 +473,14 @@ async def ui_button_callback(button: Button, interaction: Interaction, data: dic
|
|
|
473
473
|
'__private_channel__': isinstance(interaction.channel, PrivateChannel),
|
|
474
474
|
}
|
|
475
475
|
local_env.update(data)
|
|
476
|
-
x = DshellInterpreteur(code, interaction
|
|
476
|
+
x = DshellInterpreteur(code, interaction, debug=False)
|
|
477
477
|
x.env.update(local_env)
|
|
478
478
|
await x.execute()
|
|
479
479
|
else:
|
|
480
480
|
await interaction.response.defer(invisible=True)
|
|
481
481
|
|
|
482
|
+
data.update({'code': code})
|
|
483
|
+
|
|
482
484
|
def build_permission(body: list[Token], interpreter: DshellInterpreteur) -> dict[
|
|
483
485
|
Union[Member, Role], PermissionOverwrite]:
|
|
484
486
|
"""
|
|
@@ -30,6 +30,7 @@ dshell_commands: dict[str, Callable] = {
|
|
|
30
30
|
"sm": dshell_send_message, # send message
|
|
31
31
|
"spm": dshell_send_private_message, # send private message
|
|
32
32
|
"srm": dshell_respond_message, # respond to a message
|
|
33
|
+
"sri": dshell_respond_interaction, # respond to an interaction
|
|
33
34
|
"dm": dshell_delete_message,
|
|
34
35
|
"pm": dshell_purge_message,
|
|
35
36
|
"em": dshell_edit_message, # edit message
|
|
@@ -3,23 +3,23 @@ Dshell/_utils.py,sha256=PJ3fwn8IMqUMnW9oTwfr9v4--rzHIhhLQoVVqjwjoJU,23
|
|
|
3
3
|
Dshell/DISCORD_COMMANDS/__init__.py,sha256=8JPQ-6-s8PkaacmOfQgyczUiLM6rUSceHEJ60oNSis0,173
|
|
4
4
|
Dshell/DISCORD_COMMANDS/dshell_channel.py,sha256=qpNe3oE5VyLCmOeCjWlt0rvaSBv2yrkmJgrRswrNOZM,15721
|
|
5
5
|
Dshell/DISCORD_COMMANDS/dshell_member.py,sha256=5Iw-2dydhYMZOw2nx0svZP9JpZWHOXC0qkL9tClJHtw,8840
|
|
6
|
-
Dshell/DISCORD_COMMANDS/dshell_message.py,sha256=
|
|
6
|
+
Dshell/DISCORD_COMMANDS/dshell_message.py,sha256=uwE3T-Bqduqp3r4FkJ3fXVMEG-pAJGeGA2wkEhjavB0,8964
|
|
7
7
|
Dshell/DISCORD_COMMANDS/dshell_pastbin.py,sha256=TkWFGRRTvhhJgvwkDFx9Fz4UM2UUFwxyq0laMVx0mUk,881
|
|
8
8
|
Dshell/DISCORD_COMMANDS/dshell_role.py,sha256=t_yRZRD0FKE2gT4dIDIsHz2PSZZztDVEkkqkG_OkNh4,5002
|
|
9
9
|
Dshell/DISCORD_COMMANDS/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
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=
|
|
13
|
+
Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=gGKk8rvAXc-X0GBMRi03qKPbyhlwn0tF5ipfxcjzcU4,26865
|
|
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
|
|
17
17
|
Dshell/_DshellTokenizer/__init__.py,sha256=LIQSRhDx2B9pmPx5ADMwwD0Xr9ybneVLhHH8qrJWw_s,172
|
|
18
|
-
Dshell/_DshellTokenizer/dshell_keywords.py,sha256=
|
|
18
|
+
Dshell/_DshellTokenizer/dshell_keywords.py,sha256=upwwXwS0OaYhDTAnXSpem2-L4boMEYRncKK315Z5rwI,5744
|
|
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.
|
|
22
|
-
dshellinterpreter-0.2.13.
|
|
23
|
-
dshellinterpreter-0.2.13.
|
|
24
|
-
dshellinterpreter-0.2.13.
|
|
25
|
-
dshellinterpreter-0.2.13.
|
|
21
|
+
dshellinterpreter-0.2.13.10.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
|
|
22
|
+
dshellinterpreter-0.2.13.10.dist-info/METADATA,sha256=mEBCvxjA4WI6m87kMGtS-I2zVzcdKTdGf3kccU7Eq10,1152
|
|
23
|
+
dshellinterpreter-0.2.13.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
24
|
+
dshellinterpreter-0.2.13.10.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
|
|
25
|
+
dshellinterpreter-0.2.13.10.dist-info/RECORD,,
|
|
File without changes
|
{dshellinterpreter-0.2.13.8.dist-info → dshellinterpreter-0.2.13.10.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.13.8.dist-info → dshellinterpreter-0.2.13.10.dist-info}/top_level.txt
RENAMED
|
File without changes
|