fix link shortcut and mark as read
This commit is contained in:
@@ -216,6 +216,39 @@ async def get_message_content(message_id: int) -> Tuple[Optional[str], bool]:
|
||||
return None, False
|
||||
|
||||
|
||||
async def mark_as_read(message_id: int) -> Tuple[Optional[str], bool]:
|
||||
"""
|
||||
Mark a message as read by adding the 'seen' flag.
|
||||
|
||||
Args:
|
||||
message_id: The ID of the message to mark as read
|
||||
|
||||
Returns:
|
||||
Tuple containing:
|
||||
- Result message or error
|
||||
- Success status (True if operation was successful)
|
||||
"""
|
||||
try:
|
||||
cmd = f"himalaya flag add seen {message_id}"
|
||||
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
|
||||
if process.returncode == 0:
|
||||
return stdout.decode().strip() or "Marked as read", True
|
||||
else:
|
||||
error_msg = stderr.decode().strip()
|
||||
logging.error(f"Error marking message as read: {error_msg}")
|
||||
return error_msg or "Unknown error", False
|
||||
except Exception as e:
|
||||
logging.error(f"Exception during marking message as read: {e}")
|
||||
return str(e), False
|
||||
|
||||
|
||||
def sync_himalaya():
|
||||
"""This command does not exist. Halucinated by AI."""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user