Skip to content

Settings

微信设置操作类,提供各类设置的读取和修改。

基本操作

open()

打开设置面板。

logout()

退出登录。

账号与安全

get_account_info()

获取账号信息。

  • 返回 dict — 包含昵称、微信号、手机号等

get_login_method()

获取登录方式设置。

  • 返回 str

set_login_method(method)

设置登录方式。

  • method str — 登录方式

存储管理

storage_path

获取当前文件存储路径。

  • 返回 str

change_storage_path(storage_path=None)

修改文件存储路径。

is_auto_download_enabled()

是否开启自动下载。

  • 返回 bool

set_auto_download(enable, size_mb=None)

设置自动下载。

  • enable bool — 开启/关闭
  • size_mb int | None — 自动下载大小限制(MB)

auto_download_size_mb

自动下载大小限制。

  • 返回 int

is_keep_chat_history()

是否保留聊天记录。

  • 返回 bool

set_keep_chat_history(enable)

设置是否保留聊天记录。

clear_all_chat_history()

清空所有聊天记录。

manage_storage()

打开空间管理。

  • 返回 WindowControl

clean_redundant_data()

清理冗余数据。

clean_cache()

清理缓存。

get_storage_info()

获取存储空间信息。

  • 返回 dict

通用设置

get_language() / set_language(language)

获取/设置界面语言。

get_translate_language() / set_translate_language(language)

获取/设置翻译目标语言。

get_appearance() / set_appearance(appearance)

获取/设置外观主题。

get_font_size() / set_font_size(size)

获取/设置字体大小。

  • size int — 字体大小

get_auto_translate() / set_auto_translate(enable)

自动翻译开关。

get_readonly_file() / set_readonly_file(enable)

只读模式打开文件。

get_show_search_history() / set_show_search_history(enable)

显示搜索历史。

get_auto_voice_to_text() / set_auto_voice_to_text(enable)

自动语音转文字。

get_use_system_browser() / set_use_system_browser(enable)

使用系统浏览器打开链接。

get_keep_window_on_screenshot() / set_keep_window_on_screenshot(enable)

截图时保持窗口。

get_hide_on_screen_share() / set_hide_on_screen_share(enable)

共享屏幕时隐藏微信。

get_auto_update() / set_auto_update(enable)

自动更新。

get_auto_start() / set_auto_start(enable)

开机自启动。

通知设置

get_notification_info()

获取所有通知设置。

  • 返回 dict

set_notification_info(*, ...)

批量设置通知选项。

get_message_notification_sound() / set_message_notification_sound(enable)

消息通知声音。

get_voip_notification_sound() / set_voip_notification_sound(enable)

通话通知声音。

get_moment_notification_badge() / set_moment_notification_badge(enable)

朋友圈通知角标。

get_game_notification_badge() / set_game_notification_badge(enable)

游戏通知角标。

get_only_friend_interaction_reminder() / set_only_friend_interaction_reminder(enable)

仅好友互动提醒。

快捷键

get_shortcut_info()

获取快捷键配置信息。

  • 返回 dict

reset_shortcuts()

重置所有快捷键为默认值。

插件管理

get_plugins()

获取已安装的插件列表。

  • 返回 List[dict]

download_plugin(plugin_name)

下载安装指定插件。

  • plugin_name str — 插件名称
  • 返回 bool

关于

current_version

当前微信版本号。

  • 返回 str

get_about_info()

获取关于页面信息。

  • 返回 dict

check_update()

检查更新。

  • 返回 WeixinUpdate

open_help()

打开帮助页面。

upload_log()

上传日志。

open_feedback()

打开反馈页面。

open_privacy_agreement()

打开隐私协议。

open_service_agreement()

打开服务协议。

示例

python
from pywxauto import Weixin

wx = Weixin()
settings = wx.settings

# 获取账号信息
info = settings.get_account_info()
print(f"微信号: {info.get('account')}")

# 修改设置
settings.set_font_size(16)
settings.set_auto_voice_to_text(True)
settings.set_appearance("深色")

# 查看存储信息
storage = settings.get_storage_info()
print(f"存储路径: {settings.storage_path}")