dshellInterpreter 0.2.19.0__py3-none-any.whl → 0.2.19.1__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.

@@ -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
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 0.2.19.0
3
+ Version: 0.2.19.1
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
@@ -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=XK7ZcM4HVIUU6UZSDVhmBE6oLhcG9cEcCTrKpPzy_0s,15823
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
@@ -22,11 +22,11 @@ Dshell/_DshellParser/__init__.py,sha256=ONDfhZMvClqP_6tE8SLjp-cf3pXL-auQYnfYRrHZ
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=TI5O6y6gAXpM_dKxCW9Fk0H8VR-gmyxxKKOURgcHsCg,7219
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.0.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
29
- dshellinterpreter-0.2.19.0.dist-info/METADATA,sha256=8sTRftB7cAWmI2S8mOHFHI6kiyER43otCq1hdhkuDzA,1151
30
- dshellinterpreter-0.2.19.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
- dshellinterpreter-0.2.19.0.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
32
- dshellinterpreter-0.2.19.0.dist-info/RECORD,,
28
+ dshellinterpreter-0.2.19.1.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
29
+ dshellinterpreter-0.2.19.1.dist-info/METADATA,sha256=AgD4-gc2uLS-WBpCGFNN6ZIhiajg6IbZhOOzBkaCgAs,1151
30
+ dshellinterpreter-0.2.19.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
+ dshellinterpreter-0.2.19.1.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
32
+ dshellinterpreter-0.2.19.1.dist-info/RECORD,,