dshellInterpreter 0.2.19.0__py3-none-any.whl → 0.2.19.2__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_channel.py +58 -2
- Dshell/_DshellInterpreteur/dshell_interpreter.py +7 -0
- Dshell/_DshellTokenizer/dshell_keywords.py +2 -0
- {dshellinterpreter-0.2.19.0.dist-info → dshellinterpreter-0.2.19.2.dist-info}/METADATA +1 -1
- {dshellinterpreter-0.2.19.0.dist-info → dshellinterpreter-0.2.19.2.dist-info}/RECORD +8 -8
- {dshellinterpreter-0.2.19.0.dist-info → dshellinterpreter-0.2.19.2.dist-info}/WHEEL +0 -0
- {dshellinterpreter-0.2.19.0.dist-info → dshellinterpreter-0.2.19.2.dist-info}/licenses/LICENSE +0 -0
- {dshellinterpreter-0.2.19.0.dist-info → dshellinterpreter-0.2.19.2.dist-info}/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@ from asyncio import sleep
|
|
|
2
2
|
from re import search
|
|
3
3
|
from typing import Union
|
|
4
4
|
|
|
5
|
-
from discord import MISSING, PermissionOverwrite, Member, Role, Message
|
|
5
|
+
from discord import MISSING, PermissionOverwrite, Member, Role, Message, CategoryChannel
|
|
6
6
|
from discord.utils import _MissingSentinel
|
|
7
7
|
|
|
8
8
|
from .utils.utils_message import utils_get_message
|
|
@@ -21,7 +21,9 @@ __all__ = [
|
|
|
21
21
|
'dshell_create_voice_channel',
|
|
22
22
|
'dshell_edit_text_channel',
|
|
23
23
|
'dshell_edit_voice_channel',
|
|
24
|
-
'dshell_edit_thread'
|
|
24
|
+
'dshell_edit_thread',
|
|
25
|
+
'dshell_create_category',
|
|
26
|
+
'dshell_edit_category'
|
|
25
27
|
]
|
|
26
28
|
|
|
27
29
|
|
|
@@ -206,6 +208,7 @@ async def dshell_delete_channels(ctx: Message, name=None, regex=None, reason=Non
|
|
|
206
208
|
async def dshell_edit_text_channel(ctx: Message,
|
|
207
209
|
channel=None,
|
|
208
210
|
name=None,
|
|
211
|
+
category=MISSING,
|
|
209
212
|
position=MISSING,
|
|
210
213
|
slowmode=MISSING,
|
|
211
214
|
topic=MISSING,
|
|
@@ -221,6 +224,9 @@ async def dshell_edit_text_channel(ctx: Message,
|
|
|
221
224
|
if not isinstance(position, (_MissingSentinel, int)):
|
|
222
225
|
raise Exception(f"Position must be an integer, not {type(position)} !")
|
|
223
226
|
|
|
227
|
+
if category is not None and not isinstance(category, int):
|
|
228
|
+
raise Exception(f"Category must be an integer, not {type(category)} !")
|
|
229
|
+
|
|
224
230
|
if not isinstance(slowmode, (_MissingSentinel, int)):
|
|
225
231
|
raise Exception(f"Slowmode must be an integer, not {type(slowmode)} !")
|
|
226
232
|
|
|
@@ -231,12 +237,14 @@ async def dshell_edit_text_channel(ctx: Message,
|
|
|
231
237
|
raise Exception(f"NSFW must be a boolean, not {type(nsfw)} !")
|
|
232
238
|
|
|
233
239
|
channel_to_edit = ctx.channel if channel is None else ctx.channel.guild.get_channel(channel)
|
|
240
|
+
new_categoy = ctx.channel.category if category == MISSING else (ctx.channel.guild.get_channel(category) if category is not None else None)
|
|
234
241
|
|
|
235
242
|
if channel_to_edit is None:
|
|
236
243
|
raise Exception(f"Channel {channel} not found !")
|
|
237
244
|
|
|
238
245
|
await channel_to_edit.edit(name=name if name is not None else channel_to_edit.name,
|
|
239
246
|
position=position if position is not MISSING else channel_to_edit.position,
|
|
247
|
+
category=new_categoy,
|
|
240
248
|
slowmode_delay=slowmode if slowmode is not MISSING else channel_to_edit.slowmode_delay,
|
|
241
249
|
topic=topic if topic is not MISSING else channel_to_edit.topic,
|
|
242
250
|
nsfw=nsfw if nsfw is not MISSING else channel_to_edit.nsfw,
|
|
@@ -249,6 +257,7 @@ async def dshell_edit_text_channel(ctx: Message,
|
|
|
249
257
|
async def dshell_edit_voice_channel(ctx: Message,
|
|
250
258
|
channel=None,
|
|
251
259
|
name=None,
|
|
260
|
+
category=MISSING,
|
|
252
261
|
position=MISSING,
|
|
253
262
|
bitrate=MISSING,
|
|
254
263
|
permissions: dict[Union[Member, Role], PermissionOverwrite] = MISSING,
|
|
@@ -259,16 +268,21 @@ async def dshell_edit_voice_channel(ctx: Message,
|
|
|
259
268
|
if not isinstance(position, (_MissingSentinel, int)):
|
|
260
269
|
raise Exception(f"Position must be an integer, not {type(position)} !")
|
|
261
270
|
|
|
271
|
+
if category is not None and not isinstance(category, int):
|
|
272
|
+
raise Exception(f"Category must be an integer, not {type(category)} !")
|
|
273
|
+
|
|
262
274
|
if not isinstance(bitrate, (_MissingSentinel, int)):
|
|
263
275
|
raise Exception(f"Bitrate must be an integer, not {type(bitrate)} !")
|
|
264
276
|
|
|
265
277
|
channel_to_edit = ctx.channel if channel is None else ctx.channel.guild.get_channel(channel)
|
|
278
|
+
new_categoy = ctx.channel.category if category == MISSING else (ctx.channel.guild.get_channel(category) if category is not None else None)
|
|
266
279
|
|
|
267
280
|
if channel_to_edit is None:
|
|
268
281
|
raise Exception(f"Channel {channel} not found !")
|
|
269
282
|
|
|
270
283
|
await channel_to_edit.edit(name=name if name is not None else channel_to_edit.name,
|
|
271
284
|
position=position if position is not MISSING else channel_to_edit.position,
|
|
285
|
+
category=new_categoy,
|
|
272
286
|
bitrate=bitrate if bitrate is not MISSING else channel_to_edit.bitrate,
|
|
273
287
|
overwrites=permissions if permissions is not MISSING else channel_to_edit.overwrites,
|
|
274
288
|
reason=reason)
|
|
@@ -391,3 +405,45 @@ async def dshell_delete_thread(ctx: Message, thread: Union[int, str] = None, rea
|
|
|
391
405
|
|
|
392
406
|
return thread.thread.id
|
|
393
407
|
|
|
408
|
+
async def dshell_create_category(ctx: Message,
|
|
409
|
+
name,
|
|
410
|
+
position=MISSING,
|
|
411
|
+
permissions: dict[Union[Member, Role], PermissionOverwrite] = MISSING,
|
|
412
|
+
reason=None):
|
|
413
|
+
"""
|
|
414
|
+
Creates a category on the server
|
|
415
|
+
"""
|
|
416
|
+
|
|
417
|
+
if not isinstance(position, (_MissingSentinel, int)):
|
|
418
|
+
raise Exception(f"Position must be an integer, not {type(position)} !")
|
|
419
|
+
|
|
420
|
+
created_category = await ctx.guild.create_category(str(name),
|
|
421
|
+
position=position,
|
|
422
|
+
overwrites=permissions,
|
|
423
|
+
reason=reason)
|
|
424
|
+
|
|
425
|
+
return created_category.id
|
|
426
|
+
|
|
427
|
+
async def dshell_edit_category(ctx: Message,
|
|
428
|
+
category,
|
|
429
|
+
name=None,
|
|
430
|
+
position=MISSING,
|
|
431
|
+
permissions: dict[Union[Member, Role], PermissionOverwrite] = MISSING,
|
|
432
|
+
reason=None):
|
|
433
|
+
"""
|
|
434
|
+
Edits a category on the server
|
|
435
|
+
"""
|
|
436
|
+
if not isinstance(position, (_MissingSentinel, int)):
|
|
437
|
+
raise Exception(f"Position must be an integer, not {type(position)} !")
|
|
438
|
+
|
|
439
|
+
category_to_edit = ctx.channel.guild.get_channel(category)
|
|
440
|
+
|
|
441
|
+
if category_to_edit is None or not isinstance(category_to_edit, CategoryChannel):
|
|
442
|
+
raise Exception(f"Category {category} not found or is not a category !")
|
|
443
|
+
|
|
444
|
+
await category_to_edit.edit(name=name if name is not None else category_to_edit.name,
|
|
445
|
+
position=position if position is not MISSING else category_to_edit.position,
|
|
446
|
+
overwrites=permissions if permissions is not MISSING else category_to_edit.overwrites,
|
|
447
|
+
reason=reason)
|
|
448
|
+
|
|
449
|
+
return category_to_edit.id
|
|
@@ -55,12 +55,19 @@ class DshellInterpreteur:
|
|
|
55
55
|
'__author_bot__': message.author.bot,
|
|
56
56
|
'__author_nick__': message.author.nick if hasattr(message.author, 'nick') else None,
|
|
57
57
|
'__author_id__': message.author.id,
|
|
58
|
+
'__author_add_reaction__': None, # Can be overwritten by add vars_env parameter to get the author on message add event reaction
|
|
59
|
+
'__author_remove_reaction__': None, # Can be overwritten by add vars_env parameter to get the author on message remove event reaction
|
|
58
60
|
|
|
59
61
|
'__message__': message.content,
|
|
60
62
|
'__message_content__': message.content,
|
|
61
63
|
'__message_id__': message.id,
|
|
62
64
|
'__message_author__': message.author.id,
|
|
63
65
|
'__message_before__': message.content, # same as __message__, but before edit. Can be overwritten by add vars_env parameter
|
|
66
|
+
'__message_created_at__': str(message.created_at),
|
|
67
|
+
'__message_edited_at__': str(message.edited_at),
|
|
68
|
+
'__message_reactions__': ListNode([str(reaction.emoji) for reaction in message.reactions]),
|
|
69
|
+
'__message_add_reaction__': None, # Can be overwritten by add vars_env parameter to get the reaction added on message add event reaction
|
|
70
|
+
'__message_remove_reaction__': None, # Can be overwritten by add vars_env parameter to get the reaction removed on message remove event reaction
|
|
64
71
|
'__message_url__': message.jump_url if hasattr(message, 'jump_url') else None,
|
|
65
72
|
'__last_message__': message.channel.last_message_id,
|
|
66
73
|
|
|
@@ -82,6 +82,7 @@ dshell_commands: dict[str, Callable] = {
|
|
|
82
82
|
|
|
83
83
|
"cc": dshell_create_text_channel, # create channel
|
|
84
84
|
"cvc": dshell_create_voice_channel, # create voice channel
|
|
85
|
+
"cca": dshell_create_category, # create category
|
|
85
86
|
"dc": dshell_delete_channel, # delete channel
|
|
86
87
|
"dcs": dshell_delete_channels, # delete several channels by name or regex
|
|
87
88
|
|
|
@@ -106,6 +107,7 @@ dshell_commands: dict[str, Callable] = {
|
|
|
106
107
|
|
|
107
108
|
"ec": dshell_edit_text_channel, # edit text channel
|
|
108
109
|
"evc": dshell_edit_voice_channel, # edit voice channel
|
|
110
|
+
"eca": dshell_edit_category, # edit category
|
|
109
111
|
|
|
110
112
|
"cr": dshell_create_role, # create role
|
|
111
113
|
"dr": dshell_delete_roles, # delete role
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Dshell/__init__.py,sha256=gEgfeYoyHn4bUepMd0F-MSx36rR8WgQGxNpgDKo2qbA,136
|
|
2
2
|
Dshell/_utils.py,sha256=PJ3fwn8IMqUMnW9oTwfr9v4--rzHIhhLQoVVqjwjoJU,23
|
|
3
3
|
Dshell/DISCORD_COMMANDS/__init__.py,sha256=87-YpGU74m-m7AqUQni7PGbw73JRlioQkywW_61Whms,208
|
|
4
|
-
Dshell/DISCORD_COMMANDS/dshell_channel.py,sha256=
|
|
4
|
+
Dshell/DISCORD_COMMANDS/dshell_channel.py,sha256=Dy2RnoGzxZGNFvD6QErP74NdVXtfgu55w2ARJEmuUGI,18695
|
|
5
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=SI8w3tuVGNsNa4OW9h08POjhmHjUVpSUAi_0a4XBAF4,9095
|
|
@@ -16,17 +16,17 @@ Dshell/DISCORD_COMMANDS/utils/utils_permissions.py,sha256=Gi6vpCA2yXUZ20OCay5dkX
|
|
|
16
16
|
Dshell/DISCORD_COMMANDS/utils/utils_string.py,sha256=2LvJG_PR_VkPdnsw0vKNTwhEQGNog-3gFd_rZIUpGKc,4709
|
|
17
17
|
Dshell/DISCORD_COMMANDS/utils/utils_thread.py,sha256=tVl4msEwrWHY-0AytI6eY3JSs-eIFUigDSJfK9mT1ww,1457
|
|
18
18
|
Dshell/_DshellInterpreteur/__init__.py,sha256=jl_gH8MoqerW--I-IHXwUZTo80JOtfr7AOA57xVgeGQ,58
|
|
19
|
-
Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=
|
|
19
|
+
Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=I9QOEtHNmj40XlQSVmr7peKztikO-MYMiP5Ro3KXgEE,30645
|
|
20
20
|
Dshell/_DshellInterpreteur/errors.py,sha256=0PJz_VYZfNZeKR_PEHxw3tRkgKNNUerV0wwrq2r1luA,250
|
|
21
21
|
Dshell/_DshellParser/__init__.py,sha256=ONDfhZMvClqP_6tE8SLjp-cf3pXL-auQYnfYRrHZxC4,56
|
|
22
22
|
Dshell/_DshellParser/ast_nodes.py,sha256=6SGRQ4wTniah90f-teCKg-l9q3yNzazIhi7Obm38Vow,19636
|
|
23
23
|
Dshell/_DshellParser/dshell_parser.py,sha256=sJdrzJV7Voi_OKx3IazdQ9Yg_5Sk6jz2y02TmsV7T88,19080
|
|
24
24
|
Dshell/_DshellTokenizer/__init__.py,sha256=LIQSRhDx2B9pmPx5ADMwwD0Xr9ybneVLhHH8qrJWw_s,172
|
|
25
|
-
Dshell/_DshellTokenizer/dshell_keywords.py,sha256=
|
|
25
|
+
Dshell/_DshellTokenizer/dshell_keywords.py,sha256=f3bAIx8-5aVMhO2-3jbSix3r7Q6yvXMi3Xxy21mjJ0w,7325
|
|
26
26
|
Dshell/_DshellTokenizer/dshell_token_type.py,sha256=bkug7eBKjYofkOGmwzPnAH9rQlU14cO0PelZbT0kGoQ,1544
|
|
27
27
|
Dshell/_DshellTokenizer/dshell_tokenizer.py,sha256=aSXdzEyhqoYYLpMLsLwRpeQPp84PA1F5cjm9O1EYBQs,7350
|
|
28
|
-
dshellinterpreter-0.2.19.
|
|
29
|
-
dshellinterpreter-0.2.19.
|
|
30
|
-
dshellinterpreter-0.2.19.
|
|
31
|
-
dshellinterpreter-0.2.19.
|
|
32
|
-
dshellinterpreter-0.2.19.
|
|
28
|
+
dshellinterpreter-0.2.19.2.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
|
|
29
|
+
dshellinterpreter-0.2.19.2.dist-info/METADATA,sha256=T634W79HuWx48_Nd-d5BlrX95nvOjqmQ70Rd0LvD8AA,1151
|
|
30
|
+
dshellinterpreter-0.2.19.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
31
|
+
dshellinterpreter-0.2.19.2.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
|
|
32
|
+
dshellinterpreter-0.2.19.2.dist-info/RECORD,,
|
|
File without changes
|
{dshellinterpreter-0.2.19.0.dist-info → dshellinterpreter-0.2.19.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|