dshellInterpreter 0.2.9.4__tar.gz → 0.2.10.1__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.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/__init__.py +1 -2
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_message.py +5 -3
- dshellinterpreter-0.2.10.1/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
- dshellinterpreter-0.2.10.1/Dshell/DISCORD_COMMANDS/utils/utils_message.py +28 -0
- dshellinterpreter-0.2.10.1/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +35 -0
- {dshellinterpreter-0.2.9.4/dshellInterpreter.egg-info → dshellinterpreter-0.2.10.1}/PKG-INFO +1 -1
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1/dshellInterpreter.egg-info}/PKG-INFO +1 -1
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/dshellInterpreter.egg-info/SOURCES.txt +3 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/setup.py +7 -3
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellInterpreteur/__init__.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellInterpreteur/dshell_interpreter.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellParser/__init__.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellParser/ast_nodes.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellParser/dshell_parser.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellTokenizer/__init__.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellTokenizer/dshell_keywords.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellTokenizer/dshell_token_type.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellTokenizer/dshell_tokenizer.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/__init__.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_utils.py +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/LICENSE +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/README.md +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/dshellInterpreter.egg-info/requires.txt +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/dshellInterpreter.egg-info/top_level.txt +0 -0
- {dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/setup.cfg +0 -0
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_message.py
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from re import search
|
|
2
2
|
|
|
3
|
-
from discord import Embed, Message
|
|
3
|
+
from discord import Embed, Message
|
|
4
4
|
from discord.ext import commands
|
|
5
|
+
from discord.abc import Messageable
|
|
5
6
|
|
|
6
7
|
from .utils.utils_message import utils_get_message
|
|
7
8
|
|
|
@@ -71,8 +72,9 @@ async def dshell_respond_message(ctx: Message, message=None, content: str = None
|
|
|
71
72
|
else:
|
|
72
73
|
raise Exception(f'Embeds must be a list of Embed objects or a single Embed object, not {type(embeds)} !')
|
|
73
74
|
|
|
74
|
-
sended_message = await
|
|
75
|
-
content=content,
|
|
75
|
+
sended_message = await Messageable.send(
|
|
76
|
+
content=str(content),
|
|
77
|
+
reference=respond_message,
|
|
76
78
|
mention_author=mention_author,
|
|
77
79
|
delete_after=delete,
|
|
78
80
|
embeds=embeds)
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from discord import Message, PartialMessage
|
|
2
|
+
from typing import Union
|
|
3
|
+
from re import search
|
|
4
|
+
|
|
5
|
+
def utils_get_message(ctx: Message, message: Union[int, str]) -> PartialMessage:
|
|
6
|
+
"""
|
|
7
|
+
Returns the message object of the specified message ID or link.
|
|
8
|
+
Message is only available in the same server as the command and in the same channel.
|
|
9
|
+
If the message is a link, it must be in the format: https://discord.com/channels/{guild_id}/{channel_id}/{message_id}
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
if isinstance(message, int):
|
|
13
|
+
return ctx.channel.get_partial_message(message)
|
|
14
|
+
|
|
15
|
+
elif isinstance(message, str):
|
|
16
|
+
match = search(r'https://discord\.com/channels/(\d+)/(\d+)/(\d+)', message)
|
|
17
|
+
if not match:
|
|
18
|
+
raise Exception("Invalid message link format. Use a valid Discord message link.")
|
|
19
|
+
guild_id = int(match.group(1))
|
|
20
|
+
channel_id = int(match.group(2))
|
|
21
|
+
message_id = int(match.group(3))
|
|
22
|
+
|
|
23
|
+
if guild_id != ctx.guild.id:
|
|
24
|
+
raise Exception("The message must be from the same server as the command !")
|
|
25
|
+
|
|
26
|
+
return ctx.guild.get_channel(channel_id).get_partial_message(message_id)
|
|
27
|
+
|
|
28
|
+
raise Exception(f"Message must be an integer or a string, not {type(message)} !")
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from discord import Message, Thread
|
|
2
|
+
from discord.errors import NotFound
|
|
3
|
+
|
|
4
|
+
from typing import Union
|
|
5
|
+
from re import search
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
async def utils_get_thread(ctx: Message, thread: Union[int, str]) -> Thread:
|
|
9
|
+
"""
|
|
10
|
+
Returns the thread object of the specified thread ID or link.
|
|
11
|
+
Thread is only available in the same server as the command and in the same channel.
|
|
12
|
+
If the thread is a link, it must be in the format: https://discord.com/channels/{guild_id}/{channel_id}/{message_id}
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
if isinstance(thread, int):
|
|
16
|
+
return ctx.channel.get_thread(thread)
|
|
17
|
+
|
|
18
|
+
elif isinstance(thread, str):
|
|
19
|
+
match = search(r'https://discord\.com/channels/(\d+)/(\d+)(/\d+)?', thread)
|
|
20
|
+
if not match:
|
|
21
|
+
raise Exception("Invalid thread link format. Use a valid Discord thread link.")
|
|
22
|
+
guild_id = int(match.group(1))
|
|
23
|
+
message_id = int(match.group(2))
|
|
24
|
+
channel_id = ctx.channel.id if len(match.groups()) == 3 else ctx.channel.id
|
|
25
|
+
|
|
26
|
+
if guild_id != ctx.guild.id:
|
|
27
|
+
raise Exception("The thread must be from the same server as the command !")
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
c = await ctx.guild.get_channel(channel_id).fetch_message(message_id)
|
|
31
|
+
return c.thread
|
|
32
|
+
except NotFound:
|
|
33
|
+
raise Exception(f"Thread with ID {message_id} not found in channel {channel_id} !")
|
|
34
|
+
|
|
35
|
+
raise Exception(f"Thread must be an integer or a string, not {type(thread)} !")
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/dshellInterpreter.egg-info/SOURCES.txt
RENAMED
|
@@ -9,6 +9,9 @@ Dshell/DISCORD_COMMANDS/dshell_member.py
|
|
|
9
9
|
Dshell/DISCORD_COMMANDS/dshell_message.py
|
|
10
10
|
Dshell/DISCORD_COMMANDS/dshell_pastbin.py
|
|
11
11
|
Dshell/DISCORD_COMMANDS/dshell_role.py
|
|
12
|
+
Dshell/DISCORD_COMMANDS/utils/__init__.py
|
|
13
|
+
Dshell/DISCORD_COMMANDS/utils/utils_message.py
|
|
14
|
+
Dshell/DISCORD_COMMANDS/utils/utils_thread.py
|
|
12
15
|
Dshell/_DshellInterpreteur/__init__.py
|
|
13
16
|
Dshell/_DshellInterpreteur/dshell_interpreter.py
|
|
14
17
|
Dshell/_DshellParser/__init__.py
|
|
@@ -5,15 +5,19 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="dshellInterpreter",
|
|
8
|
-
version="0.2.
|
|
8
|
+
version="0.2.10.1",
|
|
9
9
|
author="Chronos",
|
|
10
10
|
author_email="vagabonwalybi@gmail.com",
|
|
11
11
|
description="A Discord bot interpreter for creating custom commands and automations.",
|
|
12
12
|
long_description=long_description,
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
14
14
|
url="https://github.com/BOXERRMD/Dshell_Interpreter",
|
|
15
|
-
packages=["Dshell",
|
|
16
|
-
"Dshell.
|
|
15
|
+
packages=["Dshell",
|
|
16
|
+
"Dshell._DshellInterpreteur",
|
|
17
|
+
"Dshell._DshellTokenizer",
|
|
18
|
+
"Dshell._DshellParser",
|
|
19
|
+
"Dshell.DISCORD_COMMANDS",
|
|
20
|
+
"Dshell.DISCORD_COMMANDS.utils"],
|
|
17
21
|
install_requires=["py-cord==2.6.1", "requests"],
|
|
18
22
|
classifiers=[
|
|
19
23
|
"Programming Language :: Python :: 3",
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_channel.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_member.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/DISCORD_COMMANDS/dshell_role.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellInterpreteur/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellParser/dshell_parser.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellTokenizer/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellTokenizer/dshell_keywords.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/Dshell/_DshellTokenizer/dshell_tokenizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/dshellInterpreter.egg-info/requires.txt
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.9.4 → dshellinterpreter-0.2.10.1}/dshellInterpreter.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|