跳转到正文
红包类

领取普通红包

grab_red_packet:直接领取普通红包(不适用于口令、语音等特殊红包)。

const char *grab_red_packet(
    uint64_t self_id, const char *platform, uint64_t group_id, uint64_t user_id,
    const char *listid, const char *authkey,
    uint64_t channel, uint64_t pay_flag, uint64_t hb_from);
void free_string(const char *value);
  • 权限:grab_red_packet
  • 调用要求:需要账号在线,请在工作线程中调用

参数

参数类型必填说明
self_iduint64_t是来自收到红包的同一条消息,不能为 0
platformconst char *是来自收到红包的同一条消息(PLATFORM_*)
group_iduint64_t是群号(私聊传 0)
user_iduint64_t是红包发送人 QQ 号,不能为 0
listid / authkeyconst char *是取自同一条 redpack 消息段 data 的同名非空字符串字段,原样传入,不得自行构造或混用
channel / pay_flag / hb_fromuint64_t是取自同一条 redpack 消息段 data 的同名无符号整数字段,原样传入

返回值

返回完整 UTF-8 JSON 字符串(包含业务结果或错误信息),NULL 表示接口不可用或请求失败。框架自动记录 [插件名] [grab_red_packet] 完整 JSON 日志。用完必须调用 free_string() 交还。

本页目录