DiscordBotLinuxMonitor 1.7.9__tar.gz → 1.7.10__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DiscordBotLinuxMonitor
3
- Version: 1.7.9
3
+ Version: 1.7.10
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DiscordBotLinuxMonitor
3
- Version: 1.7.9
3
+ Version: 1.7.10
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
@@ -33,7 +33,7 @@ __email__ = "quentin@comte-gaz.com"
33
33
  __license__ = "MIT License"
34
34
  __copyright__ = "Copyright Quentin Comte-Gaz (2026)"
35
35
  __python_version__ = "3.+"
36
- __version__ = "1.7.9 (2026/09/19)"
36
+ __version__ = "1.7.10 (2026/09/19)"
37
37
  __status__ = "Usable for any Linux project"
38
38
 
39
39
  # pyright: reportMissingTypeStubs=false
@@ -1155,15 +1155,14 @@ class DiscordBotLinuxMonitor:
1155
1155
  # Redémarrer le service et récupérer le message de sortie
1156
1156
  is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
1157
1157
  out_msg: str = await self.monitoring.restart_service(is_private=is_private, service_name=service_name, force_restart=True)
1158
- out_msg = f"Parameters received: service_name={service_name!r}\n{out_msg}"
1159
1158
 
1160
1159
  # Répondre à l'utilisateur
1161
- await self._interaction_followup_send_embed(interaction=interaction, title="Restart Service", icon="🔄", msg=out_msg)
1160
+ await self._interaction_followup_send_embed(interaction=interaction, title="Restart Service" + f" — {service_name}", icon="🔄", msg=out_msg)
1162
1161
 
1163
1162
  except Exception as e:
1164
- out_msg = f"**Internal error restarting service**\nParameters received: service_name={service_name!r}\n```sh\n{e}\n```"
1163
+ out_msg = f"**Internal error restarting service {service_name}**:\n```sh\n{e}\n```"
1165
1164
  logging.exception(msg=out_msg)
1166
- await self._interaction_followup_send_embed(interaction=interaction, title="Restart Service", icon="🔄", msg=out_msg, is_error=True)
1165
+ await self._interaction_followup_send_embed(interaction=interaction, title="Restart Service" + f" — {service_name}", icon="🔄", msg=out_msg, is_error=True)
1167
1166
 
1168
1167
  async def stop_service(self, interaction: discord.Interaction, service_name: str) -> None:
1169
1168
  if not self._check_if_valid_guild(guild=interaction.guild):
@@ -1181,14 +1180,13 @@ class DiscordBotLinuxMonitor:
1181
1180
  # Arrêter le service et récupérer le message de sortie
1182
1181
  is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
1183
1182
  out_msg: str = await self.monitoring.stop_service(is_private=is_private, service_name=service_name)
1184
- out_msg = f"Parameters received: service_name={service_name!r}\n{out_msg}"
1185
1183
 
1186
1184
  # Répondre à l'utilisateur
1187
- await self._interaction_followup_send_embed(interaction=interaction, title="Stop Service", icon="🛑", msg=out_msg)
1185
+ await self._interaction_followup_send_embed(interaction=interaction, title="Stop Service" + f" — {service_name}", icon="🛑", msg=out_msg)
1188
1186
  except Exception as e:
1189
- out_msg = f"**Internal error stopping service**\nParameters received: service_name={service_name!r}\n```sh\n{e}\n```"
1187
+ out_msg = f"**Internal error stopping service {service_name}**:\n```sh\n{e}\n```"
1190
1188
  logging.exception(msg=out_msg)
1191
- await self._interaction_followup_send_embed(interaction=interaction, title="Stop Service", icon="🛑", msg=out_msg, is_error=True)
1189
+ await self._interaction_followup_send_embed(interaction=interaction, title="Stop Service" + f" — {service_name}", icon="🛑", msg=out_msg, is_error=True)
1192
1190
 
1193
1191
  async def list_services(self, interaction: discord.Interaction) -> None:
1194
1192
  if not self._check_if_valid_guild(guild=interaction.guild):
@@ -1273,14 +1271,13 @@ class DiscordBotLinuxMonitor:
1273
1271
  try:
1274
1272
  # Arrêter le processus et récupérer le message de sortie
1275
1273
  out_msg: str = await self.monitoring.kill_process(pid=pid)
1276
- out_msg = f"Parameters received: pid={pid!r}\n{out_msg}"
1277
1274
 
1278
1275
  # Répondre à l'utilisateur
1279
- await self._interaction_followup_send_embed(interaction=interaction, title="Kill Process", icon="☠️", msg=out_msg)
1276
+ await self._interaction_followup_send_embed(interaction=interaction, title="Kill Process" + f" — PID {pid}", icon="☠️", msg=out_msg)
1280
1277
  except Exception as e:
1281
- out_msg = f"**Internal error stopping process**\nParameters received: pid={pid!r}\n```sh\n{e}\n```"
1278
+ out_msg = f"**Internal error stopping process of PID {pid}**:\n```sh\n{e}\n```"
1282
1279
  logging.exception(msg=out_msg)
1283
- await self._interaction_followup_send_embed(interaction=interaction, title="Kill Process", icon="☠️", msg=out_msg, is_error=True)
1280
+ await self._interaction_followup_send_embed(interaction=interaction, title="Kill Process" + f" — PID {pid}", icon="☠️", msg=out_msg, is_error=True)
1284
1281
 
1285
1282
  async def clear_channel_messages(self, interaction: discord.Interaction, channel: discord.TextChannel) -> None:
1286
1283
  if not self._check_if_valid_guild(guild=interaction.guild):
@@ -1421,10 +1418,6 @@ class DiscordBotLinuxMonitor:
1421
1418
  except discord.HTTPException as e:
1422
1419
  if e.status == 429:
1423
1420
  _on_rate_limit_hit()
1424
- error_text = (
1425
- f"Discord API error (status {e.status}): {e}\n"
1426
- f"Parameters received: channel={channel.name!r}"
1427
- )
1428
1421
  embed = self._build_cleanup_embed(
1429
1422
  channel_name=channel.name,
1430
1423
  state="error",
@@ -1433,12 +1426,11 @@ class DiscordBotLinuxMonitor:
1433
1426
  elapsed_seconds=asyncio.get_running_loop().time() - started_monotonic,
1434
1427
  last_deleted_preview=last_deleted_message_preview,
1435
1428
  scanned_count=scanned_count,
1436
- error_text=error_text,
1429
+ error_text=f"Discord API error (status {e.status}): {e}",
1437
1430
  )
1438
1431
  logging.exception(msg=f"Discord API error while clearing messages in channel '{channel.name}': {e}")
1439
1432
  await interaction.edit_original_response(content=None, embed=embed)
1440
1433
  except Exception as e:
1441
- error_text = f"{e}\nParameters received: channel={channel.name!r}"
1442
1434
  embed = self._build_cleanup_embed(
1443
1435
  channel_name=channel.name,
1444
1436
  state="error",
@@ -1447,9 +1439,9 @@ class DiscordBotLinuxMonitor:
1447
1439
  elapsed_seconds=asyncio.get_running_loop().time() - started_monotonic,
1448
1440
  last_deleted_preview=last_deleted_message_preview,
1449
1441
  scanned_count=scanned_count,
1450
- error_text=error_text,
1442
+ error_text=str(e),
1451
1443
  )
1452
- logging.exception(msg=f"Internal error while clearing messages in channel '{channel.name}' with parameters channel={channel.name!r}: {e}")
1444
+ logging.exception(msg=f"Internal error while clearing messages in channel '{channel.name}': {e}")
1453
1445
  await interaction.edit_original_response(content=None, embed=embed)
1454
1446
  finally:
1455
1447
  heartbeat_stop_event.set()
@@ -1724,10 +1716,14 @@ class DiscordBotLinuxMonitor:
1724
1716
  out_msg += f"**/{cmd}** — {info['desc']}\n"
1725
1717
  out_msg += f" └─ {private_indicator} | ⏳ Cooldown: {info['cooldown']}\n\n"
1726
1718
 
1727
- out_msg = f"Parameters received: command_name={command_name!r}\n{out_msg}"
1728
- await self._interaction_followup_send_embed(interaction=interaction, title="Discord Bot Commands Help", icon="🔍", msg=out_msg)
1719
+ if command_name:
1720
+ title = f"Help for command '{command_name}'"
1721
+ else:
1722
+ title = "Discord Bot Commands Help"
1723
+
1724
+ await self._interaction_followup_send_embed(interaction=interaction, title=title, icon="🔍", msg=out_msg)
1729
1725
  except Exception as e:
1730
- out_msg = f"**Internal error retrieving help**:\nParameters received: command_name={command_name!r}\n```sh\n{e}\n```"
1726
+ out_msg = f"**Internal error retrieving help**:\n```sh\n{e}\n```"
1731
1727
  logging.exception(msg=out_msg)
1732
1728
  await self._interaction_followup_send_embed(interaction=interaction, title="Help", icon="🔍", msg=out_msg, is_error=True)
1733
1729
 
@@ -1775,18 +1771,24 @@ class DiscordBotLinuxMonitor:
1775
1771
  # Indiquer que la commande est en cours de traitement
1776
1772
  await interaction.response.defer()
1777
1773
 
1774
+ if parameters:
1775
+ title = f"Execute Command — {command_name} {parameters}"
1776
+ else:
1777
+ title = f"Execute Command — {command_name}"
1778
+
1778
1779
  try:
1779
1780
  is_private: bool = self._is_private_channel(channel=interaction.channel) # type: ignore
1780
1781
  # Exécuter la commande demandée
1781
1782
  out_msg: str = await self.monitoring.execute_command(is_private=is_private, command_name=command_name, parameters=parameters)
1782
- out_msg = f"Parameters received: command_name={command_name!r}, parameters={parameters!r}\n{out_msg}"
1783
1783
 
1784
1784
  # Répondre à l'utilisateur
1785
- await self._interaction_followup_send_embed(interaction=interaction, title=f"Execute Command — {command_name}", icon="▶️", msg=out_msg)
1785
+ # On y inclu les params que si fournis, pour que l'utilisateur voie ce qu'il a demandé.
1786
+
1787
+ await self._interaction_followup_send_embed(interaction=interaction, title=title, icon="▶️", msg=out_msg)
1786
1788
  except Exception as e:
1787
- out_msg = f"**Internal error executing command '{command_name}'**:\nParameters received: command_name={command_name!r}, parameters={parameters!r}\n```sh\n{e}\n```"
1789
+ out_msg = f"**Internal error executing command '{command_name}'**:\n```sh\n{e}\n```"
1788
1790
  logging.exception(msg=out_msg)
1789
- await self._interaction_followup_send_embed(interaction=interaction, title=f"Execute Command — {command_name}", icon="▶️", msg=out_msg, is_error=True)
1791
+ await self._interaction_followup_send_embed(interaction=interaction, title=title, icon="▶️", msg=out_msg, is_error=True)
1790
1792
 
1791
1793
  async def execute_all_commands(self, interaction: discord.Interaction) -> None:
1792
1794
  if not self._check_if_valid_guild(guild=interaction.guild):
@@ -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.7.9",
9
+ version="1.7.10",
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",