feat: Implement 'clear' command in terminal

Add functionality to clear the terminal output history when the user enters 'clear' or 'cls'. This improves the usability of the terminal feature by allowing users to easily reset the display.
This commit is contained in:
Slipstream 2025-05-17 19:02:26 -06:00
parent 22a278f748
commit 8d13bb3963
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -237,8 +237,14 @@ class TerminalCog(commands.Cog, name="Terminal"):
await interaction.response.send_message("Terminal session is not active. Use `/terminal` to start.", ephemeral=True)
return
# Add command to history (before execution)
self.output_history.append(f"{self.current_cwd}> {command}")
# Handle 'clear' command separately
if command.strip().lower() == "clear" or command.strip().lower() == "cls":
self.output_history.clear()
self.output_history.append(f"{self.current_cwd}> ") # Add new prompt
self.scroll_offset = 0 # Reset scroll
await self._update_terminal_message(interaction)
return
# Handle 'cd' command separately
if command.strip().lower().startswith("cd "):