v1.2.1: Fix redundant admin text in help command output

This commit is contained in:
cottongin 2025-02-25 03:09:20 -08:00
parent 96acbc127b
commit 5e8b419c15
3 changed files with 19 additions and 11 deletions

View File

@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [1.2.1] - 2024-07-10
### Fixed
- Removed redundant "(admin only)" text from help command output when admin commands are already grouped under the Admin section
- Improved help command to only show "(admin only)" when a specific admin command is queried
## [1.2.0] - 2024-07-01 ## [1.2.0] - 2024-07-01
### Added ### Added
@ -75,7 +81,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Multi-bot support - Multi-bot support
- Configuration via YAML files - Configuration via YAML files
[Unreleased]: https://code.cottongin.xyz/cottongin/Icecast-metadata-IRC-announcer/compare/v1.2.0...HEAD [Unreleased]: https://code.cottongin.xyz/cottongin/Icecast-metadata-IRC-announcer/compare/v1.2.1...HEAD
[1.2.1]: https://code.cottongin.xyz/cottongin/Icecast-metadata-IRC-announcer/compare/v1.2.0...v1.2.1
[1.2.0]: https://code.cottongin.xyz/cottongin/Icecast-metadata-IRC-announcer/compare/v1.0.1...v1.2.0 [1.2.0]: https://code.cottongin.xyz/cottongin/Icecast-metadata-IRC-announcer/compare/v1.0.1...v1.2.0
[1.0.1]: https://code.cottongin.xyz/cottongin/Icecast-metadata-IRC-announcer/compare/v1.0.0...v1.0.1 [1.0.1]: https://code.cottongin.xyz/cottongin/Icecast-metadata-IRC-announcer/compare/v1.0.0...v1.0.1
[1.0.0]: https://code.cottongin.xyz/cottongin/Icecast-metadata-IRC-announcer/releases/tag/v1.0.0 [1.0.0]: https://code.cottongin.xyz/cottongin/Icecast-metadata-IRC-announcer/releases/tag/v1.0.0

View File

@ -1 +1 @@
1.2.0 1.2.1

19
main.py
View File

@ -490,8 +490,9 @@ class IcecastBot:
if handler and handler.__doc__: if handler and handler.__doc__:
# Get the first line of the docstring # Get the first line of the docstring
first_line = handler.__doc__.strip().split('\n')[0] first_line = handler.__doc__.strip().split('\n')[0]
# Format it using the template and add (admin only) if needed # Extract the description part after the colon
desc = first_line.split(':', 1)[1].strip() desc = first_line.split(':', 1)[1].strip()
# Add (admin only) for specific command queries
if pattern in self.admin_commands: if pattern in self.admin_commands:
desc = f"{desc} (admin only)" desc = f"{desc} (admin only)"
help_text = self.help_specific_format.format( help_text = self.help_specific_format.format(
@ -559,7 +560,7 @@ class IcecastBot:
@self.bot.on_message(create_command_pattern('restart')) @self.bot.on_message(create_command_pattern('restart'))
@self.admin_required @self.admin_required
async def restart_bot(message): async def restart_bot(message):
"""!restart: Restart the bot (admin only) """!restart: Restart the bot
Gracefully shuts down the bot and signals the bot.sh script Gracefully shuts down the bot and signals the bot.sh script
to restart it. This ensures a clean restart. to restart it. This ensures a clean restart.
@ -581,7 +582,7 @@ class IcecastBot:
@self.bot.on_message(create_command_pattern('quit')) @self.bot.on_message(create_command_pattern('quit'))
@self.admin_required @self.admin_required
async def quit_bot(message): async def quit_bot(message):
"""!quit: Shutdown the bot (admin only) """!quit: Shutdown the bot
Gracefully shuts down the bot and exits without restarting. Gracefully shuts down the bot and exits without restarting.
@ -600,7 +601,7 @@ class IcecastBot:
@self.bot.on_message(create_command_pattern('reconnect')) @self.bot.on_message(create_command_pattern('reconnect'))
@self.admin_required @self.admin_required
async def reconnect_stream(message): async def reconnect_stream(message):
"""!reconnect: Reconnect to the stream (admin only) """!reconnect: Reconnect to the stream
Attempts to reconnect to the stream and verifies the connection. Attempts to reconnect to the stream and verifies the connection.
Reports success or failure back to the channel. Reports success or failure back to the channel.
@ -616,7 +617,7 @@ class IcecastBot:
@self.bot.on_message(create_command_pattern('stop')) @self.bot.on_message(create_command_pattern('stop'))
@self.admin_required @self.admin_required
async def stop_monitoring(message): async def stop_monitoring(message):
"""!stop: Stop stream monitoring (admin only) """!stop: Stop stream monitoring
Stops monitoring the stream for metadata changes. Stops monitoring the stream for metadata changes.
The bot remains connected to IRC. The bot remains connected to IRC.
@ -632,7 +633,7 @@ class IcecastBot:
@self.bot.on_message(create_command_pattern('start')) @self.bot.on_message(create_command_pattern('start'))
@self.admin_required @self.admin_required
async def start_monitoring(message): async def start_monitoring(message):
"""!start: Start stream monitoring (admin only) """!start: Start stream monitoring
Starts monitoring the stream for metadata changes. Starts monitoring the stream for metadata changes.
Will announce new songs in the channel. Will announce new songs in the channel.
@ -648,7 +649,7 @@ class IcecastBot:
@self.bot.on_message(create_command_pattern('quiet')) @self.bot.on_message(create_command_pattern('quiet'))
@self.admin_required @self.admin_required
async def quiet_bot(message): async def quiet_bot(message):
"""!quiet: Disable song announcements (admin only) """!quiet: Disable song announcements
Continues monitoring the stream for metadata changes, Continues monitoring the stream for metadata changes,
but stops announcing songs in the channel. but stops announcing songs in the channel.
@ -665,7 +666,7 @@ class IcecastBot:
@self.bot.on_message(create_command_pattern('unquiet')) @self.bot.on_message(create_command_pattern('unquiet'))
@self.admin_required @self.admin_required
async def unquiet_bot(message): async def unquiet_bot(message):
"""!unquiet: Enable song announcements (admin only) """!unquiet: Enable song announcements
Resumes announcing songs in the channel. Resumes announcing songs in the channel.
The bot must already be monitoring the stream. The bot must already be monitoring the stream.
@ -1201,7 +1202,7 @@ class IcecastBot:
if handler and handler.__doc__: if handler and handler.__doc__:
# Extract the first line of the docstring # Extract the first line of the docstring
first_line = handler.__doc__.strip().split('\n')[0] first_line = handler.__doc__.strip().split('\n')[0]
# Remove the command prefix and colon # Extract the description part after the colon
desc = first_line.split(':', 1)[1].strip() desc = first_line.split(':', 1)[1].strip()
commands.append(section_config['format'].format( commands.append(section_config['format'].format(