DiscordBotLinuxMonitor 1.3.0__tar.gz → 1.4.0__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.
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/DiscordBotLinuxMonitor.egg-info/PKG-INFO +7 -2
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/DiscordBotLinuxMonitor.egg-info/requires.txt +1 -1
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/PKG-INFO +7 -2
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/README.md +5 -0
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/discordbotlinuxmonitor/__main__.py +12 -0
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/discordbotlinuxmonitor/discordbotlinuxmonitor.py +66 -2
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/setup.py +2 -2
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/DiscordBotLinuxMonitor.egg-info/SOURCES.txt +0 -0
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/DiscordBotLinuxMonitor.egg-info/dependency_links.txt +0 -0
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/DiscordBotLinuxMonitor.egg-info/top_level.txt +0 -0
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/LICENSE.md +0 -0
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/discordbotlinuxmonitor/__init__.py +0 -0
- {discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DiscordBotLinuxMonitor
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: From discord channels: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
|
|
5
5
|
Home-page: https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library
|
|
6
6
|
Author: Quentin Comte-Gaz
|
|
@@ -22,7 +22,7 @@ Classifier: Environment :: Console
|
|
|
22
22
|
Requires-Python: >=3.3
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE.md
|
|
25
|
-
Requires-Dist: linuxmonitor~=1.
|
|
25
|
+
Requires-Dist: linuxmonitor~=1.4.0
|
|
26
26
|
Requires-Dist: discord.py
|
|
27
27
|
Requires-Dist: typing
|
|
28
28
|
Requires-Dist: asyncio
|
|
@@ -83,6 +83,11 @@ Displayed infos are not the same if you do the command in private or public chan
|
|
|
83
83
|
- `/ports`: 🔒 Check ports 🔒
|
|
84
84
|
<img src="https://raw.githubusercontent.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library/master/example/ports.jpg" height="200">
|
|
85
85
|
|
|
86
|
+
- `/list_commands`: 📋 List all available commands 📋
|
|
87
|
+
|
|
88
|
+
- `/execute_command`: 🚀 Execute a command 🚀
|
|
89
|
+
|
|
90
|
+
- `/execute_all_commands`: 🚀 Execute all commands 🚀
|
|
86
91
|
|
|
87
92
|
### Private discord channel commands:
|
|
88
93
|
- `/force_sync`: 🔄 Force discord command synchronization 🔄
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DiscordBotLinuxMonitor
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: From discord channels: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
|
|
5
5
|
Home-page: https://github.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library
|
|
6
6
|
Author: Quentin Comte-Gaz
|
|
@@ -22,7 +22,7 @@ Classifier: Environment :: Console
|
|
|
22
22
|
Requires-Python: >=3.3
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE.md
|
|
25
|
-
Requires-Dist: linuxmonitor~=1.
|
|
25
|
+
Requires-Dist: linuxmonitor~=1.4.0
|
|
26
26
|
Requires-Dist: discord.py
|
|
27
27
|
Requires-Dist: typing
|
|
28
28
|
Requires-Dist: asyncio
|
|
@@ -83,6 +83,11 @@ Displayed infos are not the same if you do the command in private or public chan
|
|
|
83
83
|
- `/ports`: 🔒 Check ports 🔒
|
|
84
84
|
<img src="https://raw.githubusercontent.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library/master/example/ports.jpg" height="200">
|
|
85
85
|
|
|
86
|
+
- `/list_commands`: 📋 List all available commands 📋
|
|
87
|
+
|
|
88
|
+
- `/execute_command`: 🚀 Execute a command 🚀
|
|
89
|
+
|
|
90
|
+
- `/execute_all_commands`: 🚀 Execute all commands 🚀
|
|
86
91
|
|
|
87
92
|
### Private discord channel commands:
|
|
88
93
|
- `/force_sync`: 🔄 Force discord command synchronization 🔄
|
|
@@ -54,6 +54,11 @@ Displayed infos are not the same if you do the command in private or public chan
|
|
|
54
54
|
- `/ports`: 🔒 Check ports 🔒
|
|
55
55
|
<img src="https://raw.githubusercontent.com/QuentinCG/Discord-Bot-Linux-Monitor-Python-Library/master/example/ports.jpg" height="200">
|
|
56
56
|
|
|
57
|
+
- `/list_commands`: 📋 List all available commands 📋
|
|
58
|
+
|
|
59
|
+
- `/execute_command`: 🚀 Execute a command 🚀
|
|
60
|
+
|
|
61
|
+
- `/execute_all_commands`: 🚀 Execute all commands 🚀
|
|
57
62
|
|
|
58
63
|
### Private discord channel commands:
|
|
59
64
|
- `/force_sync`: 🔄 Force discord command synchronization 🔄
|
{discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/discordbotlinuxmonitor/__main__.py
RENAMED
|
@@ -118,6 +118,18 @@ def main() -> None:
|
|
|
118
118
|
async def kill_process(interaction: discord.Interaction, pid: int) -> None: # type: ignore
|
|
119
119
|
await discord_bot_linux_monitor.kill_process(interaction, pid)
|
|
120
120
|
|
|
121
|
+
@discord_bot.tree.command(name="list_commands", description="📋 List all available commands 📋")
|
|
122
|
+
async def list_commands(interaction: discord.Interaction) -> None: # type: ignore
|
|
123
|
+
await discord_bot_linux_monitor.list_commands(interaction)
|
|
124
|
+
|
|
125
|
+
@discord_bot.tree.command(name="execute_command", description="🚀 Execute a command 🚀")
|
|
126
|
+
async def execute_command(interaction: discord.Interaction, command_name: str) -> None: # type: ignore
|
|
127
|
+
await discord_bot_linux_monitor.execute_command(interaction, command_name=command_name)
|
|
128
|
+
|
|
129
|
+
@discord_bot.tree.command(name="execute_all_commands", description="🚀 Execute all commands 🚀")
|
|
130
|
+
async def execute_all_commands(interaction: discord.Interaction) -> None: # type: ignore
|
|
131
|
+
await discord_bot_linux_monitor.execute_all_commands(interaction)
|
|
132
|
+
|
|
121
133
|
#endregion
|
|
122
134
|
|
|
123
135
|
# Start the discord bot
|
|
@@ -33,7 +33,7 @@ __email__ = "quentin@comte-gaz.com"
|
|
|
33
33
|
__license__ = "MIT License"
|
|
34
34
|
__copyright__ = "Copyright Quentin Comte-Gaz (2024)"
|
|
35
35
|
__python_version__ = "3.+"
|
|
36
|
-
__version__ = "1.
|
|
36
|
+
__version__ = "1.4.0 (2024/10/07)"
|
|
37
37
|
__status__ = "Usable for any Linux project"
|
|
38
38
|
|
|
39
39
|
# pyright: reportMissingTypeStubs=false
|
|
@@ -750,7 +750,7 @@ class DiscordBotLinuxMonitor:
|
|
|
750
750
|
|
|
751
751
|
try:
|
|
752
752
|
# Récupérer la liste des processus actifs
|
|
753
|
-
out_msg: str = self.monitoring.get_ordered_processes()
|
|
753
|
+
out_msg: str = await self.monitoring.get_ordered_processes()
|
|
754
754
|
|
|
755
755
|
# Répondre à l'utilisateur
|
|
756
756
|
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
@@ -782,4 +782,68 @@ class DiscordBotLinuxMonitor:
|
|
|
782
782
|
logging.exception(msg=out_msg)
|
|
783
783
|
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
784
784
|
|
|
785
|
+
async def list_commands(self, interaction: discord.Interaction) -> None:
|
|
786
|
+
if not self._check_if_valid_guild(guild=interaction.guild):
|
|
787
|
+
return
|
|
788
|
+
if not (await self._is_bot_channel_interaction(interaction=interaction, send_message_if_not_bot=True)):
|
|
789
|
+
return
|
|
790
|
+
|
|
791
|
+
# Indiquer que la commande est en cours de traitement
|
|
792
|
+
await interaction.response.defer()
|
|
793
|
+
|
|
794
|
+
try:
|
|
795
|
+
is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
|
|
796
|
+
# Récupérer la liste des commandes disponibles
|
|
797
|
+
out_msg: str = await self.monitoring.list_commands(is_private=is_private)
|
|
798
|
+
|
|
799
|
+
# Répondre à l'utilisateur
|
|
800
|
+
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
801
|
+
except Exception as e:
|
|
802
|
+
out_msg = f"**Internal error retrieving available commands**:\n```sh\n{e}\n```"
|
|
803
|
+
logging.exception(msg=out_msg)
|
|
804
|
+
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
async def execute_command(self, interaction: discord.Interaction, command_name: str) -> None:
|
|
808
|
+
if not self._check_if_valid_guild(guild=interaction.guild):
|
|
809
|
+
return
|
|
810
|
+
if not (await self._is_bot_channel_interaction(interaction=interaction, send_message_if_not_bot=True)):
|
|
811
|
+
return
|
|
812
|
+
|
|
813
|
+
# Indiquer que la commande est en cours de traitement
|
|
814
|
+
await interaction.response.defer()
|
|
815
|
+
|
|
816
|
+
try:
|
|
817
|
+
is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
|
|
818
|
+
# Exécuter la commande demandée
|
|
819
|
+
out_msg: str = await self.monitoring.execute_command(is_private=is_private, command_name=command_name)
|
|
820
|
+
|
|
821
|
+
# Répondre à l'utilisateur
|
|
822
|
+
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
823
|
+
except Exception as e:
|
|
824
|
+
out_msg = f"**Internal error executing command '{command_name}'**:\n```sh\n{e}\n```"
|
|
825
|
+
logging.exception(msg=out_msg)
|
|
826
|
+
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
827
|
+
|
|
828
|
+
async def execute_all_commands(self, interaction: discord.Interaction) -> None:
|
|
829
|
+
if not self._check_if_valid_guild(guild=interaction.guild):
|
|
830
|
+
return
|
|
831
|
+
if not (await self._is_bot_channel_interaction(interaction=interaction, send_message_if_not_bot=True)):
|
|
832
|
+
return
|
|
833
|
+
|
|
834
|
+
# Indiquer que la commande est en cours de traitement
|
|
835
|
+
await interaction.response.defer()
|
|
836
|
+
|
|
837
|
+
try:
|
|
838
|
+
is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
|
|
839
|
+
# Exécuter toutes les commandes
|
|
840
|
+
out_msg: str = await self.monitoring.execute_all_commands(is_private=is_private)
|
|
841
|
+
|
|
842
|
+
# Répondre à l'utilisateur
|
|
843
|
+
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
844
|
+
except Exception as e:
|
|
845
|
+
out_msg = f"**Internal error executing all commands**:\n```sh\n{e}\n```"
|
|
846
|
+
logging.exception(msg=out_msg)
|
|
847
|
+
await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
|
|
848
|
+
|
|
785
849
|
#endregion
|
|
@@ -6,7 +6,7 @@ with io.open(file='README.md', mode='r', encoding='utf-8') as readme_file:
|
|
|
6
6
|
|
|
7
7
|
setup(
|
|
8
8
|
name="DiscordBotLinuxMonitor",
|
|
9
|
-
version="1.
|
|
9
|
+
version="1.4.0",
|
|
10
10
|
description="From discord channels: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)",
|
|
11
11
|
long_description=readme,
|
|
12
12
|
long_description_content_type="text/markdown",
|
|
@@ -36,7 +36,7 @@ setup(
|
|
|
36
36
|
keywords='discord bot warning info linux monitor monitoring server service port ping ssl certificate disk folder cpu ram swap usage ip connection',
|
|
37
37
|
platforms='Linux',
|
|
38
38
|
install_requires=[
|
|
39
|
-
"linuxmonitor~=1.
|
|
39
|
+
"linuxmonitor~=1.4.0", # follows the {MAJOR}.{MINOR}.x version range (because LinuxMonitor and DiscordBotLinuxMonitor are tightly coupled and should have same major and minor version)
|
|
40
40
|
"discord.py",
|
|
41
41
|
"typing",
|
|
42
42
|
"asyncio",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{discordbotlinuxmonitor-1.3.0 → discordbotlinuxmonitor-1.4.0}/discordbotlinuxmonitor/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|