Files
wechat_crawler/get_current_user.py
李顺东 b66bac7ca8 feat: Initialize wxauto WeChat automation project with job extraction tools
- Add wxauto package with WeChat UI automation and message handling capabilities
- Implement job_extractor.py for automated job posting extraction from WeChat groups
- Add job_extractor_gui.py providing graphical interface for job extraction tool
- Create comprehensive documentation in Chinese covering GUI usage, multi-group support, and quick start guides
- Add build configuration files (build_exe.py, build_exe.spec) for packaging as standalone executable
- Include utility scripts for WeChat interaction (auto_send_msg.py, get_history.py, receive_file_transfer.py)
- Add project configuration files (pyproject.toml, setup.cfg, requirements.txt)
- Include test files (test_api.py, test_com_fix.py) for API and compatibility validation
- Add Apache 2.0 LICENSE and comprehensive README documentation
- Configure .gitignore to exclude build artifacts, logs, and temporary files
2026-02-11 14:49:38 +08:00

32 lines
820 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
获取当前登录微信的用户名称
"""
from wxauto import WeChat
def get_current_wechat_user():
"""获取当前登录微信的用户名称
Returns:
str: 当前登录微信的用户名称如果获取失败则返回None
"""
try:
# 初始化微信实例
wx = WeChat()
# 获取当前登录用户的昵称
username = wx.nickname
print(f"当前登录的微信用户: {username}")
return username
except Exception as e:
print(f"获取微信用户名称失败: {e}")
return None
if __name__ == "__main__":
user = get_current_wechat_user()
if user:
print(f"\n成功获取用户名称: {user}")
else:
print("\n获取用户名称失败,请确保微信已登录")