dshellInterpreter 0.2.4.3__py3-none-any.whl → 0.2.5__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_member.py +59 -3
- Dshell/DISCORD_COMMANDS/dshell_role.py +10 -5
- Dshell/__init__.py +1 -0
- Dshell/_utils.py +1 -0
- {dshellinterpreter-0.2.4.3.dist-info → dshellinterpreter-0.2.5.dist-info}/METADATA +1 -1
- {dshellinterpreter-0.2.4.3.dist-info → dshellinterpreter-0.2.5.dist-info}/RECORD +9 -8
- {dshellinterpreter-0.2.4.3.dist-info → dshellinterpreter-0.2.5.dist-info}/WHEEL +0 -0
- {dshellinterpreter-0.2.4.3.dist-info → dshellinterpreter-0.2.5.dist-info}/licenses/LICENSE +0 -0
- {dshellinterpreter-0.2.4.3.dist-info → dshellinterpreter-0.2.5.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from datetime import timedelta, datetime
|
|
1
|
+
from datetime import timedelta, datetime, UTC
|
|
2
2
|
|
|
3
|
-
from discord import MISSING, Message, Member, Permissions
|
|
3
|
+
from discord import MISSING, Message, Member, Permissions, Role
|
|
4
4
|
|
|
5
5
|
__all__ = [
|
|
6
6
|
"dshell_ban_member",
|
|
@@ -78,7 +78,7 @@ async def dshell_timeout_member(ctx: Message, duration: int, member=None, reason
|
|
|
78
78
|
if duration < 0:
|
|
79
79
|
raise ValueError("Duration must be a non-negative integer.")
|
|
80
80
|
|
|
81
|
-
await target_member.timeout(until=datetime.now() + timedelta(seconds=duration), reason=reason)
|
|
81
|
+
await target_member.timeout(until=datetime.now(UTC) + timedelta(seconds=duration), reason=reason)
|
|
82
82
|
|
|
83
83
|
return target_member.id
|
|
84
84
|
|
|
@@ -184,3 +184,59 @@ async def dshell_move_member(ctx: Message, member=None, channel=None, disconnect
|
|
|
184
184
|
await target_member.move_to(target_channel, reason=reason)
|
|
185
185
|
|
|
186
186
|
return target_member.id
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
async def dshell_give_member_roles(ctx: Message, roles, member=None, reason=None):
|
|
190
|
+
"""
|
|
191
|
+
Give roles to the target member
|
|
192
|
+
"""
|
|
193
|
+
target_member = ctx.author if member is None else ctx.guild.get_member(member)
|
|
194
|
+
|
|
195
|
+
if target_member is None:
|
|
196
|
+
raise Exception(f'Member {member} not found in the server !')
|
|
197
|
+
|
|
198
|
+
if isinstance(roles, int):
|
|
199
|
+
roles = (roles, )
|
|
200
|
+
|
|
201
|
+
list_roles: list[Role] = []
|
|
202
|
+
for i in roles:
|
|
203
|
+
role_to_give = ctx.guild.get_role(i)
|
|
204
|
+
|
|
205
|
+
if role_to_give is None:
|
|
206
|
+
raise Exception(f'Role {i} not found in the server !')
|
|
207
|
+
|
|
208
|
+
list_roles.append(role_to_give)
|
|
209
|
+
|
|
210
|
+
list_roles.extend(target_member.roles)
|
|
211
|
+
|
|
212
|
+
await target_member.edit(roles=roles, reason=str(reason))
|
|
213
|
+
|
|
214
|
+
return target_member.id
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
async def dshell_remove_member_roles(ctx: Message, roles, member=None, reason=None):
|
|
218
|
+
"""
|
|
219
|
+
Remove roles to the target member
|
|
220
|
+
"""
|
|
221
|
+
target_member = ctx.author if member is None else ctx.guild.get_member(member)
|
|
222
|
+
|
|
223
|
+
if target_member is None:
|
|
224
|
+
raise Exception(f'Member {member} not found in the server !')
|
|
225
|
+
|
|
226
|
+
if isinstance(roles, int):
|
|
227
|
+
roles = (roles,)
|
|
228
|
+
|
|
229
|
+
list_roles: set[Role] = set()
|
|
230
|
+
for i in roles:
|
|
231
|
+
role_to_give = target_member.get_role(i)
|
|
232
|
+
|
|
233
|
+
if role_to_give is None:
|
|
234
|
+
raise Exception(f"{target_member.name} member doesn't have {i} role !")
|
|
235
|
+
|
|
236
|
+
list_roles.add(role_to_give)
|
|
237
|
+
|
|
238
|
+
new_set_role = list(list_roles - set(target_member.roles))
|
|
239
|
+
|
|
240
|
+
await target_member.edit(roles=new_set_role, reason=str(reason))
|
|
241
|
+
|
|
242
|
+
return target_member.id
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from discord import MISSING, Message, PermissionOverwrite
|
|
2
2
|
from discord.utils import _MissingSentinel
|
|
3
|
+
from .._utils import NoneType
|
|
3
4
|
|
|
4
5
|
__all__ = [
|
|
5
6
|
'dshell_create_role',
|
|
@@ -70,6 +71,8 @@ async def dshell_delete_roles(ctx: Message, roles, reason=None):
|
|
|
70
71
|
|
|
71
72
|
await role_to_delete.delete(reason=str(reason))
|
|
72
73
|
|
|
74
|
+
return role_to_delete.id
|
|
75
|
+
|
|
73
76
|
|
|
74
77
|
async def dshell_edit_role(ctx: Message,
|
|
75
78
|
role,
|
|
@@ -88,10 +91,10 @@ async def dshell_edit_role(ctx: Message,
|
|
|
88
91
|
|
|
89
92
|
role_to_edit = ctx.guild.get_role(role)
|
|
90
93
|
|
|
91
|
-
if not isinstance(name, (str,
|
|
94
|
+
if not isinstance(name, (str, NoneType)):
|
|
92
95
|
raise Exception(f"Name must be a string, not {type(name)} !")
|
|
93
96
|
|
|
94
|
-
if not isinstance(permissions, (dict,
|
|
97
|
+
if not isinstance(permissions, (dict, NoneType)):
|
|
95
98
|
raise Exception(f"Permissions must be a PermissionNode, not {type(permissions)} !")
|
|
96
99
|
|
|
97
100
|
if isinstance(permissions, dict):
|
|
@@ -104,13 +107,13 @@ async def dshell_edit_role(ctx: Message,
|
|
|
104
107
|
if color is not None:
|
|
105
108
|
color = build_colour(color)
|
|
106
109
|
|
|
107
|
-
if not isinstance(hoist, (bool,
|
|
110
|
+
if not isinstance(hoist, (bool, NoneType)):
|
|
108
111
|
raise Exception(f"Hoist must be a boolean, not {type(permissions)} !")
|
|
109
112
|
|
|
110
|
-
if not isinstance(mentionable, (bool,
|
|
113
|
+
if not isinstance(mentionable, (bool, NoneType)):
|
|
111
114
|
raise Exception(f"Mentionable must be a boolean, not {type(permissions)} !")
|
|
112
115
|
|
|
113
|
-
if not isinstance(position, (int,
|
|
116
|
+
if not isinstance(position, (int, NoneType)):
|
|
114
117
|
raise Exception(f"Position must be an integer, not {type(permissions)} !")
|
|
115
118
|
|
|
116
119
|
await role_to_edit.edit(name=name if name is not None else role_to_edit.name,
|
|
@@ -120,3 +123,5 @@ async def dshell_edit_role(ctx: Message,
|
|
|
120
123
|
mentionable=mentionable if mentionable is not None else role_to_edit.mentionable,
|
|
121
124
|
position=position if position is not None else role_to_edit.position,
|
|
122
125
|
reason=str(reason))
|
|
126
|
+
|
|
127
|
+
return role_to_edit.id
|
Dshell/__init__.py
CHANGED
Dshell/_utils.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
NoneType = type(None)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
Dshell/__init__.py,sha256=
|
|
1
|
+
Dshell/__init__.py,sha256=pGd94FPy8kVXH_jH566HhApQPhbPfMPnZXzH_0dPWh0,93
|
|
2
|
+
Dshell/_utils.py,sha256=PJ3fwn8IMqUMnW9oTwfr9v4--rzHIhhLQoVVqjwjoJU,23
|
|
2
3
|
Dshell/DISCORD_COMMANDS/__init__.py,sha256=_oo_aMEju4gZg-MIbF8bKMVM6CWAF0AO9DxAlemaXMw,149
|
|
3
4
|
Dshell/DISCORD_COMMANDS/dshell_channel.py,sha256=2qnbI2tUu5sowJVOVkY4p-l6Gu-5Gw9BEP3MItScvV8,8939
|
|
4
|
-
Dshell/DISCORD_COMMANDS/dshell_member.py,sha256=
|
|
5
|
+
Dshell/DISCORD_COMMANDS/dshell_member.py,sha256=CZ9UYS6cLERVAUYk6qwpyeZbFe4QKCEcUeuIHzOYlUU,7573
|
|
5
6
|
Dshell/DISCORD_COMMANDS/dshell_message.py,sha256=fLxj_Ns-krZgXEPijhWvBFLorvmbleR6JpVOR72BIa8,5180
|
|
6
7
|
Dshell/DISCORD_COMMANDS/dshell_pastbin.py,sha256=TkWFGRRTvhhJgvwkDFx9Fz4UM2UUFwxyq0laMVx0mUk,881
|
|
7
|
-
Dshell/DISCORD_COMMANDS/dshell_role.py,sha256=
|
|
8
|
+
Dshell/DISCORD_COMMANDS/dshell_role.py,sha256=fotsYWGHebgIx157q-zRbcCd90Y7jIuKCZ8udQoEzSU,4970
|
|
8
9
|
Dshell/_DshellInterpreteur/__init__.py,sha256=xy5-J-R3YmY99JF3NBHTRRLsComFxpjnCA5xacISctU,35
|
|
9
10
|
Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=dJS8frzNhKEvs-WdC7kwcZMZKefraWO4t8vLrFctjvA,22805
|
|
10
11
|
Dshell/_DshellParser/__init__.py,sha256=ONDfhZMvClqP_6tE8SLjp-cf3pXL-auQYnfYRrHZxC4,56
|
|
@@ -14,8 +15,8 @@ Dshell/_DshellTokenizer/__init__.py,sha256=LIQSRhDx2B9pmPx5ADMwwD0Xr9ybneVLhHH8q
|
|
|
14
15
|
Dshell/_DshellTokenizer/dshell_keywords.py,sha256=G9qdXr-d05QtmBdwTGa1qMDm7TDbIEkbx_-ERU97Ods,4664
|
|
15
16
|
Dshell/_DshellTokenizer/dshell_token_type.py,sha256=pWzvmj6EFGkDwNHooOAjdyysi1vZRVEostFIZSW1Ais,1483
|
|
16
17
|
Dshell/_DshellTokenizer/dshell_tokenizer.py,sha256=-EhwrfbcOcnAxOHWBE89531t25u6c6HmJuT1AKFn9Ew,7032
|
|
17
|
-
dshellinterpreter-0.2.
|
|
18
|
-
dshellinterpreter-0.2.
|
|
19
|
-
dshellinterpreter-0.2.
|
|
20
|
-
dshellinterpreter-0.2.
|
|
21
|
-
dshellinterpreter-0.2.
|
|
18
|
+
dshellinterpreter-0.2.5.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
|
|
19
|
+
dshellinterpreter-0.2.5.dist-info/METADATA,sha256=vzGDd-WRdEgnTmD13y7ZdvmdGx_VUz5bhO8Zv8ctGqk,1120
|
|
20
|
+
dshellinterpreter-0.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
21
|
+
dshellinterpreter-0.2.5.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
|
|
22
|
+
dshellinterpreter-0.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|