Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Friend

好友(继承User)

Hierarchy

Index

Constructors

Protected constructor

Properties

Protected Readonly c

Protected Optional gid

gid?: number

对方群号

Readonly uid

uid: number

Accessors

class_id

  • get class_id(): undefined | number

class_name

  • get class_name(): undefined | string

client

Private dm

  • get dm(): boolean

info

nickname

  • get nickname(): undefined | string

remark

  • get remark(): undefined | string

sex

Private target

  • get target(): number

user_id

  • get user_id(): number

Methods

Protected _preprocess

Protected _sendMsg

  • _sendMsg(proto3: Encodable, brief: string, file?: boolean): Promise<{ message_id: string; rand: number; seq: number; time: any }>
  • Parameters

    • proto3: Encodable
    • brief: string
    • file: boolean = false

    Returns Promise<{ message_id: string; rand: number; seq: number; time: any }>

addFriendBack

  • addFriendBack(seq: number, remark?: string): Promise<boolean>

asFriend

  • asFriend(strict?: boolean): Friend

asMember

  • asMember(gid: number, strict?: boolean): Member

delete

  • delete(block?: boolean): Promise<boolean>
  • 删除好友,block默认为true

    Parameters

    • block: boolean = true

    Returns Promise<boolean>

forwardFile

  • forwardFile(fid: string): Promise<string>
  • 转发离线文件

    Parameters

    • fid: string

    Returns Promise<string>

getAddFriendSetting

  • getAddFriendSetting(): Promise<number>

getAvatarUrl

  • getAvatarUrl(size?: 0 | 100 | 40 | 140): string

getChatHistory

  • getChatHistory(time?: number, cnt?: number): Promise<PrivateMessage[]>

getFileInfo

  • getFileInfo(fid: string): Promise<Omit<FileElem, "type"> & Record<"url", string>>

getFileUrl

  • getFileUrl(fid: string): Promise<string>

getForwardMsg

  • getForwardMsg(resid: string, fileName?: string): Promise<ForwardMessage[]>

getSimpleInfo

  • getSimpleInfo(): Promise<{ age: number; area: string; nickname: string; sex: Gender; user_id: number }>

getVideoUrl

  • getVideoUrl(fid: string, md5: string | Buffer): Promise<string>

makeForwardMsg

    1. 制作一条合并转发消息以备发送(制作一次可以到处发)。
    2. 需要注意的是,好友图片和群图片的内部格式不一样, 对着群制作的转发消息中的图片,发给好友可能会裂图,反过来也一样。
    3. 暂不完全支持套娃转发。

    Parameters

    Returns Promise<XmlElem>

markRead

  • markRead(time?: number): Promise<void>
  • 标记time之前为已读,默认当前时间

    Parameters

    • time: number = ...

    Returns Promise<void>

poke

  • poke(self?: boolean): Promise<boolean>
  • 戳一戳

    Parameters

    • self: boolean = false

    Returns Promise<boolean>

recallFile

  • recallFile(fid: string): Promise<boolean>
  • 撤回离线文件

    Parameters

    • fid: string

    Returns Promise<boolean>

recallMsg

  • recallMsg(msg: PrivateMessage): Promise<boolean>
  • recallMsg(msgid: string): Promise<boolean>
  • recallMsg(seq: number, rand: number, time: number): Promise<boolean>
  • recallMsg(param: string | number | PrivateMessage, rand?: number, time?: number): Promise<boolean>

sendFile

  • sendFile(file: string | Uint8Array | Buffer, filename?: string, callback?: (percentage: string) => void): Promise<string>
  • 发送离线文件

    Parameters

    • file: string | Uint8Array | Buffer

      一个文件路径,或者一块Buffer

    • Optional filename: string

      对方看到的文件名(file为Buffer时,若留空则自动以md5命名)

    • Optional callback: (percentage: string) => void

      监控上传进度的回调函数,拥有一个"百分比进度"的参数

        • (percentage: string): void
        • Parameters

          • percentage: string

          Returns void

    Returns Promise<string>

    文件id(撤回时使用)

sendMsg

setClass

  • setClass(id: number): Promise<void>
  • 设置分组(注意:如果分组id不存在也会成功)

    Parameters

    • id: number

    Returns Promise<void>

setFriendReq

  • setFriendReq(seq: number, yes?: boolean, remark?: string, block?: boolean): Promise<boolean>
  • 同意好友申请

    Parameters

    • seq: number
    • yes: boolean = true
    • remark: string = ""
    • block: boolean = false

    Returns Promise<boolean>

setGroupInvite

  • setGroupInvite(gid: number, seq: number, yes?: boolean, block?: boolean): Promise<boolean>
  • 同意群邀请

    Parameters

    • gid: number
    • seq: number
    • yes: boolean = true
    • block: boolean = false

    Returns Promise<boolean>

setGroupReq

  • setGroupReq(gid: number, seq: number, yes?: boolean, reason?: string, block?: boolean): Promise<boolean>
  • 同意入群申请

    Parameters

    • gid: number
    • seq: number
    • yes: boolean = true
    • reason: string = ""
    • block: boolean = false

    Returns Promise<boolean>

setRemark

  • setRemark(remark: string): Promise<void>
  • 设置备注

    Parameters

    • remark: string

    Returns Promise<void>

shareMusic

thumbUp

  • thumbUp(times?: number): Promise<boolean>
  • 点赞,默认一次

    Parameters

    • times: number = 1

    Returns Promise<boolean>

uploadImages

  • uploadImages(imgs: Image[] | ImageElem[]): Promise<PromiseRejectedResult[]>

uploadPtt

uploadVideo

Static as

  • as(uid: number, strict: boolean): Friend

Generated using TypeDoc