跳转到正文

API 总览

萌喵插件 SDK 全部主程序接口的职责分类、权限规则与调用约定。

在 plugin_install(api) 开头调用 api_init(api) 后,即可直接调用 plugin.h 提供的所有同名接口函数。

通用调用规则

  • 工作线程调用:所有涉及网络请求的接口都会等待服务器回应,请在插件自己的工作线程中调用,不要阻塞消息或事件回调。
  • 权限控制:受权限控制的接口其权限名与函数名一致;用户可在客户端插件页逐项开关,权限关闭时调用失败。
  • 版本兼容:客户端未提供某项接口时,返回 bool 的接口返回 false,返回指针的接口返回 NULL,free_* 不执行操作。
  • 资源交还:所有返回结构体指针或堆字符串(如红包 / 身份验证 JSON)的接口,无论成功还是失败,用完后都必须调用对应的 free_* 函数交还;借用字符串(data_dir())除外。

按职责分类

领域分组包含接口
账号相关账号管理list_accounts、get_bot_info、add_account、edit_account、offline_account、remove_account、set_nickname
账号相关登录验证list_protocols、list_devices、has_login_cache、login_cache、login_password、submit_captcha、send_sms、submit_sms
账号相关身份验证submit_identity_captcha、submit_identity_phone、confirm_identity_sms
账号相关凭据类get_client_key、get_skey、get_pskey
好友相关消息类send_friend_message、recall_friend_message
好友相关媒体类upload_friend_image、upload_friend_flash_image、upload_friend_video、upload_friend_voice
好友相关功能类list_friends、handle_friend_request、set_friend_remark、set_friend_block、set_friend_special_care、set_friend_msg_notify、delete_friend、get_summary_card、like_summary_card
群聊相关消息类send_group_message、recall_group_message、get_forward_message、upload_forward_message
群聊相关媒体类upload_group_image、upload_group_video、upload_group_voice
群聊相关红包类pre_grab_red_packet、grab_red_packet
群聊相关功能类list_groups、get_group_info、handle_group_request、rename_group、set_group_remark、set_group_msg_mask、set_group_member_name、set_group_special_title、set_group_admin、mute_group_member、sign_group、leave_group
工具工具类data_dir、write_log

本页目录