dshellInterpreter 0.2.9__py3-none-any.whl → 0.2.9.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.

@@ -1,8 +1,9 @@
1
1
  from datetime import timedelta, datetime, UTC
2
2
 
3
- from discord import MISSING, Message, Member, Permissions, Role
3
+ from discord import MISSING, Message, Member, Permissions, Role, Embed
4
4
 
5
5
  __all__ = [
6
+ "dshell_send_private_message",
6
7
  "dshell_ban_member",
7
8
  "dshell_unban_member",
8
9
  "dshell_kick_member",
@@ -16,6 +17,35 @@ __all__ = [
16
17
  "dshell_remove_member_roles"
17
18
  ]
18
19
 
20
+ async def dshell_send_private_message(ctx: Message, member: int = None, message: str = None, delete: int = None, embeds = None, ):
21
+ """
22
+ Sends a private message to a member.
23
+ If member is None, sends the message to the author of the command.
24
+ If delete is specified, deletes the message after the specified time in seconds.
25
+ """
26
+ if delete is not None and not isinstance(delete, (int, float)):
27
+ raise Exception(f'Delete parameter must be a number (seconds) or None, not {type(delete)} !')
28
+
29
+ member_to_send = ctx.author if member is None else ctx.channel.guild.get_member(member)
30
+
31
+ if member_to_send is None:
32
+ raise Exception(f'Member {member} not found!')
33
+
34
+ from .._DshellParser.ast_nodes import ListNode
35
+
36
+ if embeds is None:
37
+ embeds = ListNode([])
38
+
39
+ elif isinstance(embeds, Embed):
40
+ embeds = ListNode([embeds])
41
+
42
+ else:
43
+ raise Exception(f'Embeds must be a list of Embed objects or a single Embed object, not {type(embeds)} !')
44
+
45
+ sended_message = await member_to_send.send(message, delete_after=delete, embeds=embeds)
46
+
47
+ return sended_message.id
48
+
19
49
 
20
50
  async def dshell_ban_member(ctx: Message, member: int, reason: str = MISSING):
21
51
  """
@@ -5,6 +5,7 @@ from discord.ext import commands
5
5
 
6
6
  __all__ = [
7
7
  'dshell_send_message',
8
+ 'dshell_respond_message',
8
9
  'dshell_delete_message',
9
10
  'dshell_purge_message',
10
11
  'dshell_edit_message',
@@ -47,6 +48,32 @@ async def dshell_send_message(ctx: Message, message=None, delete=None, channel=N
47
48
  return sended_message.id
48
49
 
49
50
 
51
+ async def dshell_respond_message(ctx: Message, message=None, delete=None, embeds=None):
52
+ """
53
+ Responds to a message on Discord
54
+ """
55
+ if delete is not None and not isinstance(delete, (int, float)):
56
+ raise Exception(f'Delete parameter must be a number (seconds) or None, not {type(delete)} !')
57
+
58
+ respond_message = ctx if message is None else ctx.channel.get_partial_message(message) # builds a reference to the message (even if it doesn't exist)
59
+
60
+ from .._DshellParser.ast_nodes import ListNode
61
+
62
+ if embeds is None:
63
+ embeds = ListNode([])
64
+
65
+ elif isinstance(embeds, Embed):
66
+ embeds = ListNode([embeds])
67
+
68
+ else:
69
+ raise Exception(f'Embeds must be a list of Embed objects or a single Embed object, not {type(embeds)} !')
70
+
71
+ sended_message = await ctx.reply(respond_message,
72
+ delete_after=delete,
73
+ embeds=embeds)
74
+
75
+ return sended_message.id
76
+
50
77
  async def dshell_delete_message(ctx: Message, message=None, reason=None, delay=0):
51
78
  """
52
79
  Deletes a message
@@ -28,6 +28,8 @@ dshell_commands: dict[str, Callable] = {
28
28
  "gp": dshell_get_pastbin, # get pastbin
29
29
 
30
30
  "sm": dshell_send_message, # send message
31
+ "spm": dshell_send_private_message, # send private message
32
+ "srm": dshell_respond_message, # respond to a message
31
33
  "dm": dshell_delete_message,
32
34
  "pm": dshell_purge_message,
33
35
  "em": dshell_edit_message, # edit message
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 0.2.9
3
+ Version: 0.2.9.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
@@ -2,8 +2,8 @@ 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=_oo_aMEju4gZg-MIbF8bKMVM6CWAF0AO9DxAlemaXMw,149
4
4
  Dshell/DISCORD_COMMANDS/dshell_channel.py,sha256=kjSTJnTTXHprCURESlO_62jv3Yu832lUELJi47PyWdo,18538
5
- Dshell/DISCORD_COMMANDS/dshell_member.py,sha256=L3Ud4nza_55n9R02kfL-iNK9ybBczx6SDkccUTWxv3s,7646
6
- Dshell/DISCORD_COMMANDS/dshell_message.py,sha256=SvX9I4nYMWm8ACE56QJBM5yEiZoXIKbTLkIOyrENd5o,6253
5
+ Dshell/DISCORD_COMMANDS/dshell_member.py,sha256=CKlE9oZqI7D986uSgyRuKWJMrJD0m5BveLtzwxRtFxY,8840
6
+ Dshell/DISCORD_COMMANDS/dshell_message.py,sha256=pu5IUQH8wfteFUL0mO4Q9xEojKbKkticV-h8zrgpco8,7277
7
7
  Dshell/DISCORD_COMMANDS/dshell_pastbin.py,sha256=TkWFGRRTvhhJgvwkDFx9Fz4UM2UUFwxyq0laMVx0mUk,881
8
8
  Dshell/DISCORD_COMMANDS/dshell_role.py,sha256=fotsYWGHebgIx157q-zRbcCd90Y7jIuKCZ8udQoEzSU,4970
9
9
  Dshell/_DshellInterpreteur/__init__.py,sha256=xy5-J-R3YmY99JF3NBHTRRLsComFxpjnCA5xacISctU,35
@@ -12,11 +12,11 @@ Dshell/_DshellParser/__init__.py,sha256=ONDfhZMvClqP_6tE8SLjp-cf3pXL-auQYnfYRrHZ
12
12
  Dshell/_DshellParser/ast_nodes.py,sha256=heOMQzAchQ8UroQaMSfU_6SYEXw-nme0jGcoVkCXPUs,15284
13
13
  Dshell/_DshellParser/dshell_parser.py,sha256=RxS5GgmTel10pH9HII0X_8XZnVyIQGd9ThZZcZDpEqc,15545
14
14
  Dshell/_DshellTokenizer/__init__.py,sha256=LIQSRhDx2B9pmPx5ADMwwD0Xr9ybneVLhHH8qrJWw_s,172
15
- Dshell/_DshellTokenizer/dshell_keywords.py,sha256=V4WU7PBvP9o7qxbE0Xsd8RmT_jxVRzZa1SOr2JeTyIg,5517
15
+ Dshell/_DshellTokenizer/dshell_keywords.py,sha256=yBTXKBCb7NZa-DGDeeyIZrl_CS1Y4WCmwshUdBHQhlo,5642
16
16
  Dshell/_DshellTokenizer/dshell_token_type.py,sha256=gYIb2XN2YcgeRgmar_rBDS5CGmwfmxihu8mOW_d6lbE,1533
17
17
  Dshell/_DshellTokenizer/dshell_tokenizer.py,sha256=LZGs4Ytuyx9Galazqtz32lS4Mmu9yZya1B7AzFQAQOk,7150
18
- dshellinterpreter-0.2.9.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
19
- dshellinterpreter-0.2.9.dist-info/METADATA,sha256=IafKmA2w0eQvRLUnEydFgseeujbmQAfKjp7CJSc0WFk,1120
20
- dshellinterpreter-0.2.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- dshellinterpreter-0.2.9.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
22
- dshellinterpreter-0.2.9.dist-info/RECORD,,
18
+ dshellinterpreter-0.2.9.1.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
19
+ dshellinterpreter-0.2.9.1.dist-info/METADATA,sha256=UuWw60cLp5BQu4oyfSI5gBpCg1FOuILbcNwDeLTYO6U,1122
20
+ dshellinterpreter-0.2.9.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ dshellinterpreter-0.2.9.1.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
22
+ dshellinterpreter-0.2.9.1.dist-info/RECORD,,