DiscordBotLinuxMonitor 1.6.5__tar.gz → 1.6.6__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.5
3
+ Version: 1.6.6
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
@@ -125,6 +125,8 @@ Displayed infos are not the same if you do the command in private or public chan
125
125
 
126
126
  - `/clear_channel_messages {channel}`: 🧹 Remove all messages from a target channel (can clean any channel, command itself is private-only) 🧹
127
127
 
128
+ - `/list_clearable_channels`: 🧹 List text channels and whether the bot can clear them (View + Read History + Manage Messages), private-only 🧹
129
+
128
130
  ## How to install (for first launch)
129
131
 
130
132
  - Install package calling `python -m pip install discordbotlinuxmonitor` (or `python setup.py install` from the root of this repository)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DiscordBotLinuxMonitor
3
- Version: 1.6.5
3
+ Version: 1.6.6
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
@@ -125,6 +125,8 @@ Displayed infos are not the same if you do the command in private or public chan
125
125
 
126
126
  - `/clear_channel_messages {channel}`: 🧹 Remove all messages from a target channel (can clean any channel, command itself is private-only) 🧹
127
127
 
128
+ - `/list_clearable_channels`: 🧹 List text channels and whether the bot can clear them (View + Read History + Manage Messages), private-only 🧹
129
+
128
130
  ## How to install (for first launch)
129
131
 
130
132
  - Install package calling `python -m pip install discordbotlinuxmonitor` (or `python setup.py install` from the root of this repository)
@@ -83,6 +83,8 @@ Displayed infos are not the same if you do the command in private or public chan
83
83
 
84
84
  - `/clear_channel_messages {channel}`: 🧹 Remove all messages from a target channel (can clean any channel, command itself is private-only) 🧹
85
85
 
86
+ - `/list_clearable_channels`: 🧹 List text channels and whether the bot can clear them (View + Read History + Manage Messages), private-only 🧹
87
+
86
88
  ## How to install (for first launch)
87
89
 
88
90
  - Install package calling `python -m pip install discordbotlinuxmonitor` (or `python setup.py install` from the root of this repository)
@@ -130,6 +130,10 @@ def main() -> None:
130
130
  async def clear_channel_messages(interaction: discord.Interaction, channel: discord.TextChannel) -> None: # type: ignore
131
131
  await discord_bot_linux_monitor.clear_channel_messages(interaction, channel)
132
132
 
133
+ @discord_bot.tree.command(name="list_clearable_channels", description="[Private] 🧹 List text channels and bot clear permissions 🧹")
134
+ async def list_clearable_channels(interaction: discord.Interaction) -> None: # type: ignore
135
+ await discord_bot_linux_monitor.list_clearable_channels(interaction)
136
+
133
137
  @discord_bot.tree.command(name="list_commands", description="📋 List all available commands 📋")
134
138
  async def list_commands(interaction: discord.Interaction) -> None: # type: ignore
135
139
  await discord_bot_linux_monitor.list_commands(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.5 (2026/08/24)"
36
+ __version__ = "1.6.6 (2026/08/24)"
37
37
  __status__ = "Usable for any Linux project"
38
38
 
39
39
  # pyright: reportMissingTypeStubs=false
@@ -1118,6 +1118,55 @@ class DiscordBotLinuxMonitor:
1118
1118
  except asyncio.CancelledError:
1119
1119
  pass
1120
1120
 
1121
+ async def list_clearable_channels(self, interaction: discord.Interaction) -> None:
1122
+ if not self._check_if_valid_guild(guild=interaction.guild):
1123
+ return
1124
+ if not (await self._is_bot_channel_interaction(interaction=interaction, send_message_if_not_bot=True)):
1125
+ return
1126
+ if not self._is_private_channel(channel=interaction.channel): # type: ignore
1127
+ await interaction.response.send_message(content="❌ Public channels do not allow this command.", ephemeral=True)
1128
+ return
1129
+
1130
+ await interaction.response.defer(ephemeral=True)
1131
+
1132
+ guild = interaction.guild
1133
+ bot_member = guild.me if guild is not None else None # type: ignore
1134
+ if guild is None or bot_member is None:
1135
+ await interaction.followup.send(content="❌ Unable to resolve the guild or bot member.", ephemeral=True)
1136
+ return
1137
+
1138
+ try:
1139
+ clearable_lines: List[str] = []
1140
+ blocked_lines: List[str] = []
1141
+
1142
+ for text_channel in guild.text_channels:
1143
+ perms = text_channel.permissions_for(bot_member)
1144
+ can_view: bool = perms.view_channel
1145
+ can_read_history: bool = perms.read_message_history
1146
+ can_manage: bool = perms.manage_messages
1147
+ is_clearable: bool = can_view and can_read_history and can_manage
1148
+
1149
+ line = (
1150
+ f"{'✅' if is_clearable else '❌'} #{text_channel.name} "
1151
+ f"(View: {'✔' if can_view else '✘'}, "
1152
+ f"History: {'✔' if can_read_history else '✘'}, "
1153
+ f"Manage: {'✔' if can_manage else '✘'})"
1154
+ )
1155
+ if is_clearable:
1156
+ clearable_lines.append(line)
1157
+ else:
1158
+ blocked_lines.append(line)
1159
+
1160
+ out_msg = f"🧹 **Clearable channels report** ({len(clearable_lines)} clearable / {len(guild.text_channels)} text channels)\n\n"
1161
+ out_msg += "**✅ Clearable:**\n" + ("\n".join(clearable_lines) if clearable_lines else "None") + "\n\n"
1162
+ out_msg += "**❌ Blocked (missing bot permission):**\n" + ("\n".join(blocked_lines) if blocked_lines else "None")
1163
+
1164
+ await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
1165
+ except Exception as e:
1166
+ out_msg = f"**Internal error listing clearable channels**:\n```sh\n{e}\n```"
1167
+ logging.exception(msg=out_msg)
1168
+ await self._interaction_followup_send_no_limit(interaction=interaction, msg=out_msg)
1169
+
1121
1170
  async def list_commands(self, interaction: discord.Interaction) -> None:
1122
1171
  if not self._check_if_valid_guild(guild=interaction.guild):
1123
1172
  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.5",
9
+ version="1.6.6",
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",