From ddc9b05fed8e749a25d5736ca42be24497a1e829 Mon Sep 17 00:00:00 2001 From: Kumi Date: Fri, 8 Nov 2024 08:25:48 +0100 Subject: [PATCH] feat(bot): add help command for user and operator roles Introduced a `help_command` method to provide users and operators with a list of available commands specific to their roles. This enhancement improves user experience by offering quick access to critical command information directly within the chat environment. --- src/matrix_applicationbot/classes/bot.py | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/matrix_applicationbot/classes/bot.py b/src/matrix_applicationbot/classes/bot.py index 010241c..60280b2 100644 --- a/src/matrix_applicationbot/classes/bot.py +++ b/src/matrix_applicationbot/classes/bot.py @@ -496,3 +496,37 @@ class ApplicationBot: await self.client.room_send( target_room_id, "m.room.message", event.source["content"] ) + + async def help_command(self, room, sender): + if await self.is_operator(sender): + help_message = ( + "Operator Commands:\n" + "1. `!supportbot help` - Show this help message.\n" + "2. `!supportbot openticket` - Open a support ticket.\n" + "3. `!supportbot invite ` - Invite an operator to a ticket room.\n" + "4. `!supportbot close ` - Close a support ticket.\n" + "5. `!supportbot approve ` - Approve an application and invite to protected rooms.\n" + "6. `!supportbot reject ` - Reject an application.\n" + "7. `!supportbot list` - List open tickets.\n" + "8. `!supportbot monitor ` - Monitor a room for automatic ticket creation.\n" + "9. `!supportbot unmonitor ` - Stop monitoring a room.\n" + "10. `!supportbot monitored` - List monitored rooms.\n" + "11. `!supportbot protect ` - Protect a room.\n" + "12. `!supportbot unprotect ` - Unprotect a room.\n" + "13. `!supportbot protected` - List protected rooms." + ) + else: + help_message = ( + "User Commands:\n" + "1. `!supportbot help` - Show this help message.\n" + "2. `!supportbot openticket` - Open a support ticket." + ) + + await self.client.room_send( + room.room_id, + "m.room.message", + { + "msgtype": "m.text", + "body": help_message, + }, + ) \ No newline at end of file