dshellInterpreter 0.1.11__tar.gz → 0.1.12__tar.gz
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.
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/DISCORD_COMMANDS/dshell_channel.py +9 -10
- dshellinterpreter-0.1.12/Dshell/DISCORD_COMMANDS/dshell_member.py +67 -0
- dshellinterpreter-0.1.12/Dshell/DISCORD_COMMANDS/dshell_message.py +113 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellInterpreteur/dshell_interpreter.py +3 -3
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellTokenizer/dshell_keywords.py +3 -0
- {dshellinterpreter-0.1.11/dshellInterpreter.egg-info → dshellinterpreter-0.1.12}/PKG-INFO +1 -1
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12/dshellInterpreter.egg-info}/PKG-INFO +1 -1
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/setup.py +1 -1
- dshellinterpreter-0.1.11/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -54
- dshellinterpreter-0.1.11/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -60
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellInterpreteur/__init__.py +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellParser/__init__.py +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellParser/ast_nodes.py +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellParser/dshell_parser.py +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellTokenizer/__init__.py +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellTokenizer/dshell_token_type.py +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellTokenizer/dshell_tokenizer.py +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/__init__.py +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/LICENSE +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/README.md +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/dshellInterpreter.egg-info/requires.txt +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/dshellInterpreter.egg-info/top_level.txt +0 -0
- {dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/setup.cfg +0 -0
{dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/DISCORD_COMMANDS/dshell_channel.py
RENAMED
|
@@ -2,8 +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
|
|
6
|
-
from discord.abc import GuildChannel
|
|
5
|
+
from discord import MISSING, PermissionOverwrite, Member, Role, Message
|
|
7
6
|
|
|
8
7
|
__all__ = [
|
|
9
8
|
'dshell_create_text_channel',
|
|
@@ -13,7 +12,7 @@ __all__ = [
|
|
|
13
12
|
]
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
async def dshell_create_text_channel(ctx:
|
|
15
|
+
async def dshell_create_text_channel(ctx: Message,
|
|
17
16
|
name,
|
|
18
17
|
category=None,
|
|
19
18
|
position=MISSING,
|
|
@@ -25,7 +24,7 @@ async def dshell_create_text_channel(ctx: GuildChannel,
|
|
|
25
24
|
Creates a text channel on the server
|
|
26
25
|
"""
|
|
27
26
|
|
|
28
|
-
channel_category = ctx.guild.get_channel(category)
|
|
27
|
+
channel_category = ctx.channel.guild.get_channel(category)
|
|
29
28
|
|
|
30
29
|
created_channel = await ctx.guild.create_text_channel(name,
|
|
31
30
|
category=channel_category,
|
|
@@ -38,7 +37,7 @@ async def dshell_create_text_channel(ctx: GuildChannel,
|
|
|
38
37
|
|
|
39
38
|
return created_channel.id
|
|
40
39
|
|
|
41
|
-
async def dshell_create_voice_channel(ctx:
|
|
40
|
+
async def dshell_create_voice_channel(ctx: Message,
|
|
42
41
|
name,
|
|
43
42
|
category=None,
|
|
44
43
|
position=MISSING,
|
|
@@ -49,7 +48,7 @@ async def dshell_create_voice_channel(ctx: GuildChannel,
|
|
|
49
48
|
Creates a voice channel on the server
|
|
50
49
|
"""
|
|
51
50
|
|
|
52
|
-
channel_category = ctx.guild.get_channel(category)
|
|
51
|
+
channel_category = ctx.channel.guild.get_channel(category)
|
|
53
52
|
|
|
54
53
|
created_channel = await ctx.guild.create_voice_channel(name,
|
|
55
54
|
category=channel_category,
|
|
@@ -61,13 +60,13 @@ async def dshell_create_voice_channel(ctx: GuildChannel,
|
|
|
61
60
|
return created_channel.id
|
|
62
61
|
|
|
63
62
|
|
|
64
|
-
async def dshell_delete_channel(ctx:
|
|
63
|
+
async def dshell_delete_channel(ctx: Message, channel=None, reason=None, timeout=0):
|
|
65
64
|
"""
|
|
66
65
|
Deletes a channel.
|
|
67
66
|
You can add a waiting time before it is deleted (in seconds)
|
|
68
67
|
"""
|
|
69
68
|
|
|
70
|
-
channel_to_delete = ctx if channel is None else ctx.guild.get_channel(channel)
|
|
69
|
+
channel_to_delete = ctx.channel if channel is None else ctx.channel.guild.get_channel(channel)
|
|
71
70
|
|
|
72
71
|
if channel_to_delete is None:
|
|
73
72
|
raise Exception(f"Le channel {channel} n'existe pas !")
|
|
@@ -79,12 +78,12 @@ async def dshell_delete_channel(ctx: GuildChannel, channel=None, reason=None, ti
|
|
|
79
78
|
return channel_to_delete.id
|
|
80
79
|
|
|
81
80
|
|
|
82
|
-
async def dshell_delete_channels(ctx:
|
|
81
|
+
async def dshell_delete_channels(ctx: Message, name=None, regex=None, reason=None):
|
|
83
82
|
"""
|
|
84
83
|
Deletes all channels with the same name and/or matching the same regex.
|
|
85
84
|
If neither is set, it will delete all channels with the same name as the one where the command was executed.
|
|
86
85
|
"""
|
|
87
|
-
for channel in ctx.guild.channels:
|
|
86
|
+
for channel in ctx.channel.guild.channels:
|
|
88
87
|
|
|
89
88
|
if name is not None and channel.name == str(name):
|
|
90
89
|
await channel.delete(reason=reason)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from discord import MISSING, Message
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"dshell_ban_member",
|
|
6
|
+
"dshell_unban_member",
|
|
7
|
+
"dshell_kick_member",
|
|
8
|
+
"dshell_rename_member"
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
async def dshell_ban_member(ctx: Message, member: int, reason: str = MISSING):
|
|
12
|
+
"""
|
|
13
|
+
Bans a member from the server.
|
|
14
|
+
"""
|
|
15
|
+
banned_member = ctx.channel.guild.get_member(member)
|
|
16
|
+
|
|
17
|
+
if not banned_member:
|
|
18
|
+
return 1 # Member not found in the server
|
|
19
|
+
|
|
20
|
+
await ctx.channel.guild.ban(banned_member, reason=reason)
|
|
21
|
+
|
|
22
|
+
return banned_member.id
|
|
23
|
+
|
|
24
|
+
async def dshell_unban_member(ctx: Message, user: int, reason: str = MISSING):
|
|
25
|
+
"""
|
|
26
|
+
Unbans a user from the server.
|
|
27
|
+
"""
|
|
28
|
+
banned_users = ctx.channel.guild.bans()
|
|
29
|
+
user_to_unban = None
|
|
30
|
+
|
|
31
|
+
async for ban_entry in banned_users:
|
|
32
|
+
if ban_entry.user.id == user:
|
|
33
|
+
user_to_unban = ban_entry.user
|
|
34
|
+
break
|
|
35
|
+
|
|
36
|
+
if not user_to_unban:
|
|
37
|
+
return 1 # User not found in the banned list
|
|
38
|
+
|
|
39
|
+
await ctx.channel.guild.unban(user_to_unban, reason=reason)
|
|
40
|
+
|
|
41
|
+
return user_to_unban.id
|
|
42
|
+
|
|
43
|
+
async def dshell_kick_member(ctx: Message, member: int, reason: str = MISSING):
|
|
44
|
+
"""
|
|
45
|
+
Kicks a member from the server.
|
|
46
|
+
"""
|
|
47
|
+
kicked_member = ctx.channel.guild.get_member(member)
|
|
48
|
+
|
|
49
|
+
if not kicked_member:
|
|
50
|
+
return 1 # Member not found in the server
|
|
51
|
+
|
|
52
|
+
await ctx.channel.guild.kick(kicked_member, reason=reason)
|
|
53
|
+
|
|
54
|
+
return kicked_member.id
|
|
55
|
+
|
|
56
|
+
async def dshell_rename_member(ctx: Message, new_name, member=None):
|
|
57
|
+
"""
|
|
58
|
+
Renames a member in the server.
|
|
59
|
+
"""
|
|
60
|
+
renamed_member = ctx.channel.guild.get_member(member)
|
|
61
|
+
|
|
62
|
+
if not renamed_member:
|
|
63
|
+
return 1 # Member not found in the server
|
|
64
|
+
|
|
65
|
+
await renamed_member.edit(nick=new_name)
|
|
66
|
+
|
|
67
|
+
return renamed_member.id
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from discord import Embed, Message
|
|
2
|
+
from discord.ext import commands
|
|
3
|
+
from .._DshellParser.ast_nodes import ListNode
|
|
4
|
+
from re import search
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
'dshell_send_message',
|
|
8
|
+
'dshell_delete_message',
|
|
9
|
+
'dshell_purge_message',
|
|
10
|
+
'dshell_edit_message',
|
|
11
|
+
'dshell_research_regex_message',
|
|
12
|
+
'dshell_research_regex_in_content'
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
async def dshell_send_message(ctx: Message, message=None, delete=None, channel=None, embeds=None, embed=None):
|
|
17
|
+
from .._DshellParser.ast_nodes import ListNode
|
|
18
|
+
"""
|
|
19
|
+
Sends a message on Discord
|
|
20
|
+
"""
|
|
21
|
+
channel_to_send = ctx.channel if channel is None else ctx.channel.guild.get_channel(channel)
|
|
22
|
+
|
|
23
|
+
if channel_to_send is None:
|
|
24
|
+
raise Exception(f'Channel {channel} not found!')
|
|
25
|
+
|
|
26
|
+
if embeds is None:
|
|
27
|
+
embeds = ListNode([])
|
|
28
|
+
|
|
29
|
+
elif isinstance(embeds, Embed):
|
|
30
|
+
embeds = ListNode([embeds])
|
|
31
|
+
|
|
32
|
+
if embed is not None and isinstance(embed, Embed):
|
|
33
|
+
embeds.add(embed)
|
|
34
|
+
|
|
35
|
+
sended_message = await channel_to_send.send(message,
|
|
36
|
+
delete_after=delete,
|
|
37
|
+
embeds=embeds)
|
|
38
|
+
|
|
39
|
+
return sended_message.id
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
async def dshell_delete_message(ctx: Message, message, reason=None, delay=0):
|
|
43
|
+
"""
|
|
44
|
+
Deletes a message
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
delete_message = ctx.channel.get_partial_message(message) # builds a reference to the message (even if it doesn't exist)
|
|
48
|
+
|
|
49
|
+
if delay > 3600:
|
|
50
|
+
raise Exception(f'The message deletion delay is too long! ({delay} seconds)')
|
|
51
|
+
|
|
52
|
+
await delete_message.delete(delay=delay, reason=reason)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
async def dshell_purge_message(ctx: Message, message_number, channel=None, reason=None):
|
|
56
|
+
"""
|
|
57
|
+
Purges messages from a channel
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
purge_channel = ctx.channel if channel is None else ctx.channel.guild.get_channel(channel)
|
|
61
|
+
|
|
62
|
+
if purge_channel is None:
|
|
63
|
+
raise Exception(f"Channel {channel} to purge not found!")
|
|
64
|
+
|
|
65
|
+
await purge_channel.purge(limit=message_number, reason=reason)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def dshell_edit_message(ctx: Message, message, new_content=None, embeds=None):
|
|
69
|
+
"""
|
|
70
|
+
Edits a message
|
|
71
|
+
"""
|
|
72
|
+
edit_message = ctx.channel.get_partial_message(message) # builds a reference to the message (even if it doesn't exist)
|
|
73
|
+
|
|
74
|
+
if embeds is None:
|
|
75
|
+
embeds = []
|
|
76
|
+
|
|
77
|
+
elif isinstance(embeds, Embed):
|
|
78
|
+
embeds = [embeds]
|
|
79
|
+
|
|
80
|
+
await edit_message.edit(content=new_content, embeds=embeds)
|
|
81
|
+
|
|
82
|
+
return edit_message.id
|
|
83
|
+
|
|
84
|
+
async def dshell_research_regex_message(ctx: Message, regex, channel=None):
|
|
85
|
+
"""
|
|
86
|
+
Searches for messages matching a regex in a channel
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
search_channel = ctx.channel if channel is None else ctx.channel.guild.get_channel(channel)
|
|
90
|
+
|
|
91
|
+
if search_channel is None:
|
|
92
|
+
raise Exception(f"Channel {channel} to search not found!")
|
|
93
|
+
|
|
94
|
+
messages = ListNode([])
|
|
95
|
+
async for message in search_channel.history(limit=100):
|
|
96
|
+
if search(regex, message.content):
|
|
97
|
+
messages.add(message)
|
|
98
|
+
|
|
99
|
+
if not messages:
|
|
100
|
+
raise commands.CommandError(f"No messages found matching the regex '{regex}'.")
|
|
101
|
+
|
|
102
|
+
return messages
|
|
103
|
+
|
|
104
|
+
async def dshell_research_regex_in_content(ctx: Message, regex, content):
|
|
105
|
+
"""
|
|
106
|
+
Searches for a regex in a specific message content
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
if not search(regex, content):
|
|
110
|
+
return True
|
|
111
|
+
|
|
112
|
+
return False
|
|
113
|
+
|
|
@@ -3,7 +3,7 @@ from re import findall
|
|
|
3
3
|
from typing import TypeVar, Union, Any, Optional, Callable
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
from discord import AutoShardedBot, Embed, Colour, PermissionOverwrite, Permissions, Guild, Member, Role
|
|
6
|
+
from discord import AutoShardedBot, Embed, Colour, PermissionOverwrite, Permissions, Guild, Member, Role, Message
|
|
7
7
|
from discord.abc import GuildChannel, PrivateChannel
|
|
8
8
|
|
|
9
9
|
from .._DshellParser.ast_nodes import *
|
|
@@ -15,7 +15,7 @@ from .._DshellTokenizer.dshell_token_type import Token
|
|
|
15
15
|
from .._DshellTokenizer.dshell_tokenizer import DshellTokenizer
|
|
16
16
|
|
|
17
17
|
All_nodes = TypeVar('All_nodes', IfNode, LoopNode, ElseNode, ElifNode, ArgsCommandNode, VarNode, IdentOperationNode)
|
|
18
|
-
context = TypeVar('context', AutoShardedBot,
|
|
18
|
+
context = TypeVar('context', AutoShardedBot, Message, PrivateChannel)
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class DshellInterpreteur:
|
|
@@ -299,7 +299,7 @@ def build_permission(body: list[Token], interpreter: DshellInterpreteur) -> dict
|
|
|
299
299
|
|
|
300
300
|
for i in args_permissions:
|
|
301
301
|
i.pop('*')
|
|
302
|
-
permissions.update(DshellPermissions(i).get_permission_overwrite(interpreter.ctx.guild))
|
|
302
|
+
permissions.update(DshellPermissions(i).get_permission_overwrite(interpreter.ctx.channel.guild))
|
|
303
303
|
|
|
304
304
|
return permissions
|
|
305
305
|
|
{dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellTokenizer/dshell_keywords.py
RENAMED
|
@@ -31,6 +31,9 @@ dshell_commands: dict[str, Callable] = {
|
|
|
31
31
|
"bm": dshell_ban_member, # ban member
|
|
32
32
|
"um": dshell_unban_member, # unban member
|
|
33
33
|
"km": dshell_kick_member, # kick member
|
|
34
|
+
"em": dshell_edit_message, # edit message
|
|
35
|
+
"srm": dshell_research_regex_message, # research regex in message
|
|
36
|
+
"src": dshell_research_regex_in_content, # research regex in content
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
dshell_mathematical_operators: dict[str, tuple[Callable, int]] = {
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="dshellInterpreter",
|
|
8
|
-
version="0.1.
|
|
8
|
+
version="0.1.12",
|
|
9
9
|
author="Chronos",
|
|
10
10
|
author_email="vagabonwalybi@gmail.com",
|
|
11
11
|
description="A Discord bot interpreter for creating custom commands and automations.",
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
from discord import Member, User, MISSING
|
|
2
|
-
from discord.abc import GuildChannel
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
__all__ = [
|
|
6
|
-
"dshell_ban_member",
|
|
7
|
-
"dshell_unban_member",
|
|
8
|
-
"dshell_kick_member"
|
|
9
|
-
]
|
|
10
|
-
|
|
11
|
-
async def dshell_ban_member(ctx: GuildChannel, member: int, reason: str = MISSING):
|
|
12
|
-
"""
|
|
13
|
-
Bans a member from the server.
|
|
14
|
-
"""
|
|
15
|
-
banned_member = ctx.guild.get_member(member)
|
|
16
|
-
|
|
17
|
-
if not banned_member:
|
|
18
|
-
return 1 # Member not found in the server
|
|
19
|
-
|
|
20
|
-
await ctx.guild.ban(banned_member, reason=reason)
|
|
21
|
-
|
|
22
|
-
return banned_member.id
|
|
23
|
-
|
|
24
|
-
async def dshell_unban_member(ctx: GuildChannel, user: int, reason: str = MISSING):
|
|
25
|
-
"""
|
|
26
|
-
Unbans a user from the server.
|
|
27
|
-
"""
|
|
28
|
-
banned_users = ctx.guild.bans()
|
|
29
|
-
user_to_unban = None
|
|
30
|
-
|
|
31
|
-
async for ban_entry in banned_users:
|
|
32
|
-
if ban_entry.user.id == user:
|
|
33
|
-
user_to_unban = ban_entry.user
|
|
34
|
-
break
|
|
35
|
-
|
|
36
|
-
if not user_to_unban:
|
|
37
|
-
return 1 # User not found in the banned list
|
|
38
|
-
|
|
39
|
-
await ctx.guild.unban(user_to_unban, reason=reason)
|
|
40
|
-
|
|
41
|
-
return user_to_unban.id
|
|
42
|
-
|
|
43
|
-
async def dshell_kick_member(ctx: GuildChannel, member: int, reason: str = MISSING):
|
|
44
|
-
"""
|
|
45
|
-
Kicks a member from the server.
|
|
46
|
-
"""
|
|
47
|
-
kicked_member = ctx.guild.get_member(member)
|
|
48
|
-
|
|
49
|
-
if not kicked_member:
|
|
50
|
-
return 1 # Member not found in the server
|
|
51
|
-
|
|
52
|
-
await ctx.guild.kick(kicked_member, reason=reason)
|
|
53
|
-
|
|
54
|
-
return kicked_member.id
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
from discord import Embed
|
|
2
|
-
from discord.abc import GuildChannel
|
|
3
|
-
|
|
4
|
-
__all__ = [
|
|
5
|
-
'dshell_send_message',
|
|
6
|
-
'dshell_delete_message',
|
|
7
|
-
'dshell_purge_message'
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
async def dshell_send_message(ctx: GuildChannel, message=None, delete=None, channel=None, embeds=None, embed=None):
|
|
12
|
-
from .._DshellParser.ast_nodes import ListNode
|
|
13
|
-
"""
|
|
14
|
-
Sends a message on Discord
|
|
15
|
-
"""
|
|
16
|
-
channel_to_send = ctx if channel is None else ctx.guild.get_channel(channel)
|
|
17
|
-
|
|
18
|
-
if channel_to_send is None:
|
|
19
|
-
raise Exception(f'Channel {channel} not found!')
|
|
20
|
-
|
|
21
|
-
if embeds is None:
|
|
22
|
-
embeds = ListNode([])
|
|
23
|
-
|
|
24
|
-
elif isinstance(embeds, Embed):
|
|
25
|
-
embeds = ListNode([embeds])
|
|
26
|
-
|
|
27
|
-
if embed is not None and isinstance(embed, Embed):
|
|
28
|
-
embeds.add(embed)
|
|
29
|
-
|
|
30
|
-
sended_message = await channel_to_send.send(message,
|
|
31
|
-
delete_after=delete,
|
|
32
|
-
embeds=embeds)
|
|
33
|
-
|
|
34
|
-
return sended_message.id
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
async def dshell_delete_message(ctx: GuildChannel, message, reason=None, delay=0):
|
|
38
|
-
"""
|
|
39
|
-
Deletes a message
|
|
40
|
-
"""
|
|
41
|
-
|
|
42
|
-
delete_message = ctx.get_partial_message(message) # builds a reference to the message (even if it doesn't exist)
|
|
43
|
-
|
|
44
|
-
if delay > 3600:
|
|
45
|
-
raise Exception(f'The message deletion delay is too long! ({delay} seconds)')
|
|
46
|
-
|
|
47
|
-
await delete_message.delete(delay=delay, reason=reason)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
async def dshell_purge_message(ctx: GuildChannel, message_number, channel=None, reason=None):
|
|
51
|
-
"""
|
|
52
|
-
Purges messages from a channel
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
purge_channel = ctx if channel is None else ctx.guild.get_channel(channel)
|
|
56
|
-
|
|
57
|
-
if purge_channel is None:
|
|
58
|
-
raise Exception(f"Channel {channel} to purge not found!")
|
|
59
|
-
|
|
60
|
-
await purge_channel.purge(limit=message_number, reason=reason)
|
|
File without changes
|
{dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellInterpreteur/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellTokenizer/dshell_token_type.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/Dshell/_DshellTokenizer/dshell_tokenizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/dshellInterpreter.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/dshellInterpreter.egg-info/requires.txt
RENAMED
|
File without changes
|
{dshellinterpreter-0.1.11 → dshellinterpreter-0.1.12}/dshellInterpreter.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|