first commit: New project

This commit is contained in:
2025-11-03 17:22:25 +08:00
commit 0501502995
13 changed files with 952 additions and 0 deletions

35
main.py Normal file
View File

@@ -0,0 +1,35 @@
import sys
import os
from src.send import MemosAPI, send_memo
def main():
"""Memos CLI 主函数"""
print("=== Memos CLI ===")
print("一个命令行Memos内容发布工具")
try:
# 测试API连接
api = MemosAPI()
if api.test_connection():
print("[SUCCESS] 成功连接到Memos服务器")
# 发送欢迎消息
result = api.send_memo(
content="欢迎使用Memos CLI",
visibility="PRIVATE",
tags=["欢迎", "CLI"]
)
print(f"[SUCCESS] 欢迎消息已发送Memo ID: {result.get('id')}")
else:
print("[ERROR] 无法连接到Memos服务器")
print("请检查 .env 文件中的配置")
except ValueError as e:
print(f"[ERROR] 配置错误: {e}")
print("请确保已正确配置 .env 文件")
except Exception as e:
print(f"[ERROR] 发生错误: {e}")
if __name__ == "__main__":
main()