wip
This commit is contained in:
@@ -116,28 +116,28 @@ async def delete_message(message_id: int) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
async def archive_message(message_id: int) -> bool:
|
||||
"""
|
||||
Archive a message by its ID.
|
||||
# async def archive_message(message_id: int) -> [str, bool]:
|
||||
# """
|
||||
# Archive a message by its ID.
|
||||
|
||||
Args:
|
||||
message_id: The ID of the message to archive
|
||||
# Args:
|
||||
# message_id: The ID of the message to archive
|
||||
|
||||
Returns:
|
||||
True if archiving was successful, False otherwise
|
||||
"""
|
||||
try:
|
||||
process = await asyncio.create_subprocess_shell(
|
||||
f"himalaya message move Archives {message_id}",
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
# Returns:
|
||||
# True if archiving was successful, False otherwise
|
||||
# """
|
||||
# try:
|
||||
# process = await asyncio.create_subprocess_shell(
|
||||
# f"himalaya message move Archives {message_id}",
|
||||
# stdout=asyncio.subprocess.PIPE,
|
||||
# stderr=asyncio.subprocess.PIPE,
|
||||
# )
|
||||
# stdout, stderr = await process.communicate()
|
||||
|
||||
return process.returncode == 0
|
||||
except Exception as e:
|
||||
logging.error(f"Exception during message archiving: {e}")
|
||||
return False
|
||||
# return [stdout.decode(), process.returncode == 0]
|
||||
# except Exception as e:
|
||||
# logging.error(f"Exception during message archiving: {e}")
|
||||
# return False
|
||||
|
||||
|
||||
async def archive_messages(message_ids: List[str]) -> Tuple[Optional[str], bool]:
|
||||
@@ -197,8 +197,7 @@ async def get_message_content(message_id: int) -> Tuple[Optional[str], bool]:
|
||||
content = stdout.decode()
|
||||
return content, True
|
||||
else:
|
||||
logging.error(f"Error retrieving message content: {
|
||||
stderr.decode()}")
|
||||
logging.error(f"Error retrieving message content: {stderr.decode()}")
|
||||
return None, False
|
||||
except Exception as e:
|
||||
logging.error(f"Exception during message content retrieval: {e}")
|
||||
|
||||
Reference in New Issue
Block a user