DiscordBotLinuxMonitor 1.6.2__tar.gz → 1.6.3__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.6.2
3
+ Version: 1.6.3
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
@@ -98,6 +98,8 @@ Displayed infos are not the same if you do the command in private or public chan
98
98
 
99
99
  - `/list_commands`: 📋 List all available commands 📋
100
100
 
101
+ - `/version`: 🤖 Show current bot version 🤖
102
+
101
103
  - `/execute_command {command_name} [parameters]`: 🚀 Execute a command (optional parameters, only for commands with `accept_parameters` or a `{arg1}`/`{args}` placeholder) 🚀
102
104
 
103
105
  - `/execute_all_commands`: 🚀 Execute all commands 🚀
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DiscordBotLinuxMonitor
3
- Version: 1.6.2
3
+ Version: 1.6.3
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
@@ -98,6 +98,8 @@ Displayed infos are not the same if you do the command in private or public chan
98
98
 
99
99
  - `/list_commands`: 📋 List all available commands 📋
100
100
 
101
+ - `/version`: 🤖 Show current bot version 🤖
102
+
101
103
  - `/execute_command {command_name} [parameters]`: 🚀 Execute a command (optional parameters, only for commands with `accept_parameters` or a `{arg1}`/`{args}` placeholder) 🚀
102
104
 
103
105
  - `/execute_all_commands`: 🚀 Execute all commands 🚀
@@ -56,6 +56,8 @@ Displayed infos are not the same if you do the command in private or public chan
56
56
 
57
57
  - `/list_commands`: 📋 List all available commands 📋
58
58
 
59
+ - `/version`: 🤖 Show current bot version 🤖
60
+
59
61
  - `/execute_command {command_name} [parameters]`: 🚀 Execute a command (optional parameters, only for commands with `accept_parameters` or a `{arg1}`/`{args}` placeholder) 🚀
60
62
 
61
63
  - `/execute_all_commands`: 🚀 Execute all commands 🚀
@@ -54,6 +54,10 @@ def main() -> None:
54
54
  async def force_sync(interaction: discord.Interaction) -> None: # type: ignore
55
55
  await discord_bot_linux_monitor.force_sync(interaction)
56
56
 
57
+ @discord_bot.tree.command(name="version", description="🤖 Show bot version 🤖")
58
+ async def version(interaction: discord.Interaction) -> None: # type: ignore
59
+ await discord_bot_linux_monitor.version(interaction)
60
+
57
61
  @discord_bot.tree.command(name="usage", description="📊 View disk space, CPU, RAM, ... 📊")
58
62
  async def usage(interaction: discord.Interaction) -> None: # type: ignore
59
63
  await discord_bot_linux_monitor.usage(interaction)
@@ -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.6.2 (2026/08/24)"
36
+ __version__ = "1.6.3 (2026/08/24)"
37
37
  __status__ = "Usable for any Linux project"
38
38
 
39
39
  # pyright: reportMissingTypeStubs=false
@@ -286,6 +286,9 @@ class DiscordBotLinuxMonitor:
286
286
  logging.exception(msg=out_msg)
287
287
  return out_msg
288
288
 
289
+ def _welcome_message_with_version(self, welcome_message: str) -> str:
290
+ return f"{welcome_message}\n\n🤖 Bot version: {__version__}"
291
+
289
292
  def _get_rate_limit_wait_seconds(self, error: discord.HTTPException, fallback_seconds: float = 1.5) -> float:
290
293
  retry_after = getattr(error, "retry_after", None)
291
294
  if isinstance(retry_after, (int, float)) and retry_after > 0:
@@ -309,7 +312,11 @@ class DiscordBotLinuxMonitor:
309
312
  async def _delete_message_with_rate_limit_retry(self, message: discord.Message, reason: str, max_retries: int = 10, on_rate_limit: Optional[Callable[[], None]] = None) -> None:
310
313
  for attempt in range(max_retries + 1):
311
314
  try:
312
- await message.delete(reason=reason)
315
+ try:
316
+ await message.delete(reason=reason)
317
+ except TypeError:
318
+ # Some discord.py objects (e.g. PartialMessage) do not accept `reason`.
319
+ await message.delete()
313
320
  return
314
321
  except discord.NotFound:
315
322
  return
@@ -330,7 +337,11 @@ class DiscordBotLinuxMonitor:
330
337
  for attempt in range(max_retries + 1):
331
338
  try:
332
339
  if len(messages) == 1:
333
- await messages[0].delete(reason=reason)
340
+ try:
341
+ await messages[0].delete(reason=reason)
342
+ except TypeError:
343
+ # Some discord.py objects (e.g. PartialMessage) do not accept `reason`.
344
+ await messages[0].delete()
334
345
  else:
335
346
  await channel.delete_messages(messages, reason=reason)
336
347
  return
@@ -370,20 +381,20 @@ class DiscordBotLinuxMonitor:
370
381
  logging.info(msg="Found the public channel, it will be possible to do public commands.")
371
382
  public_channel_cmd_ready = True
372
383
  if self.welcome_message_for_public_commands != "":
373
- await self._channel_send_no_limit(channel=channel, msg=self.welcome_message_for_public_commands)
384
+ await self._channel_send_no_limit(channel=channel, msg=self._welcome_message_with_version(self.welcome_message_for_public_commands))
374
385
 
375
386
  if self.channel_name_for_private_commands != "" and channel.name == self.channel_name_for_private_commands:
376
387
  logging.info(msg="Found the private channel, it will be possible to do private commands.")
377
388
  private_channel_cmd_ready = True
378
389
  if self.welcome_message_for_private_commands != "":
379
- await self._channel_send_no_limit(channel=channel, msg=self.welcome_message_for_private_commands)
390
+ await self._channel_send_no_limit(channel=channel, msg=self._welcome_message_with_version(self.welcome_message_for_private_commands))
380
391
 
381
392
  if self.channel_name_for_public_error_tasks != "" and channel.name == self.channel_name_for_public_error_tasks:
382
393
  logging.info(msg="Found the public channel for error task, it will be possible to show public status issues if found periodically.")
383
394
  public_channel_error_task_ready = True
384
395
 
385
396
  if self.welcome_message_for_public_error_tasks != "":
386
- await self._channel_send_no_limit(channel=channel, msg=self.welcome_message_for_public_error_tasks)
397
+ await self._channel_send_no_limit(channel=channel, msg=self._welcome_message_with_version(self.welcome_message_for_public_error_tasks))
387
398
 
388
399
  logging.info(msg=f"Activating automatic public follow and public service restart if down with '{self.bot.user}' and guild '{guild.name}' (id: '{guild.id}') on channel '{channel.name}' (id '{channel.id}').")
389
400
  public_channel_for_error_task: discord.TextChannel = channel
@@ -397,7 +408,7 @@ class DiscordBotLinuxMonitor:
397
408
  public_channel_info_task_ready = True
398
409
 
399
410
  if self.welcome_message_for_public_infos_tasks != "":
400
- await self._channel_send_no_limit(channel=channel, msg=self.welcome_message_for_public_infos_tasks)
411
+ await self._channel_send_no_limit(channel=channel, msg=self._welcome_message_with_version(self.welcome_message_for_public_infos_tasks))
401
412
 
402
413
  logging.info(msg=f"Activating automatic public follow info with '{self.bot.user}' and guild '{guild.name}' (id: '{guild.id}') on channel '{channel.name}' (id '{channel.id}').")
403
414
  public_channel_for_info_task: discord.TextChannel = channel
@@ -411,7 +422,7 @@ class DiscordBotLinuxMonitor:
411
422
  private_channel_error_task_ready = True
412
423
 
413
424
  if self.welcome_message_for_private_error_tasks != "":
414
- await self._channel_send_no_limit(channel=channel, msg=self.welcome_message_for_private_error_tasks)
425
+ await self._channel_send_no_limit(channel=channel, msg=self._welcome_message_with_version(self.welcome_message_for_private_error_tasks))
415
426
 
416
427
  logging.info(msg=f"Activating automatic private follow and public service restart if down with '{self.bot.user}' and guild '{guild.name}' (id: '{guild.id}') on channel '{channel.name}' (id '{channel.id}').")
417
428
  private_channel_for_error_task: discord.TextChannel = channel
@@ -425,7 +436,7 @@ class DiscordBotLinuxMonitor:
425
436
  private_channel_info_task_ready = True
426
437
 
427
438
  if self.welcome_message_for_private_infos_tasks != "":
428
- await self._channel_send_no_limit(channel=channel, msg=self.welcome_message_for_private_infos_tasks)
439
+ await self._channel_send_no_limit(channel=channel, msg=self._welcome_message_with_version(self.welcome_message_for_private_infos_tasks))
429
440
 
430
441
  logging.info(msg=f"Activating automatic private follow info with '{self.bot.user}' and guild '{guild.name}' (id: '{guild.id}') on channel '{channel.name}' (id '{channel.id}').")
431
442
  private_channel_for_info_task: discord.TextChannel = channel
@@ -486,6 +497,18 @@ class DiscordBotLinuxMonitor:
486
497
  # Respond to the user
487
498
  await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
488
499
 
500
+ async def version(self, interaction: discord.Interaction) -> None:
501
+ if not self._check_if_valid_guild(guild=interaction.guild):
502
+ return
503
+ if not (await self._is_bot_channel_interaction(interaction=interaction, send_message_if_not_bot=True)):
504
+ return
505
+
506
+ out_msg: str = (
507
+ f"🤖 Bot version: {__version__}\n"
508
+ f"🐍 Python compatibility: {__python_version__}"
509
+ )
510
+ await interaction.response.send_message(content=out_msg, ephemeral=True)
511
+
489
512
  async def usage(self, interaction: discord.Interaction) -> None:
490
513
  if not self._check_if_valid_guild(guild=interaction.guild):
491
514
  return
@@ -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.6.2",
9
+ version="1.6.3",
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",