Options
All
  • Public
  • Public/Protected
  • All
Menu

Class User

Hierarchy

Index

Constructors

Protected constructor

Properties

Protected Readonly c

Protected Optional gid

gid?: number

对方群号

Readonly uid

uid: number

Accessors

client

Private dm

  • get dm(): boolean

Private target

  • get target(): number

user_id

  • get user_id(): number

Methods

Private _getRouting

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>
  • 回添双向好友

    Parameters

    • seq: number
    • remark: string = ""

    Returns Promise<boolean>

asFriend

  • asFriend(strict?: boolean): Friend

asMember

  • asMember(gid: number, strict?: boolean): Member
  • 返回作为某群群员的实例

    Parameters

    • gid: number
    • strict: boolean = false

    Returns Member

getAddFriendSetting

  • getAddFriendSetting(): Promise<number>

getAvatarUrl

  • getAvatarUrl(size?: 0 | 100 | 40 | 140): string
  • 获取头像url

    Parameters

    • size: 0 | 100 | 40 | 140 = 0

    Returns string

getChatHistory

  • getChatHistory(time?: number, cnt?: number): Promise<PrivateMessage[]>
  • 获取time往前的cnt条聊天记录,默认当前时间,cnt默认20不能超过20

    Parameters

    • time: number = ...
    • cnt: number = 20

    Returns Promise<PrivateMessage[]>

getFileInfo

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

getFileUrl

  • getFileUrl(fid: string): Promise<string>
  • 获取离线文件下载地址

    Parameters

    • fid: string

    Returns Promise<string>

getForwardMsg

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

getSimpleInfo

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

    Returns 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>

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>

sendMsg

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>

uploadImages

  • uploadImages(imgs: Image[] | ImageElem[]): Promise<PromiseRejectedResult[]>
  • 上传一批图片以备发送(无数量限制)(理论上传一次所有群和好友都能发)

    Parameters

    Returns Promise<PromiseRejectedResult[]>

uploadPtt

uploadVideo

Static as

  • as(uid: number): User

Generated using TypeDoc