ppagent / WCOASource
Class: WCOASource
Defined in: src/source/wcoa.source.ts:93
微信公众平台的消息源。
Implements
Constructors
Constructor
new WCOASource(
_options
):WCOASource
Defined in: src/source/wcoa.source.ts:175
Parameters
_options
Returns
WCOASource
Properties
event
event:
Emittery
Defined in: src/source/wcoa.source.ts:204
用户发布订阅事件的对象,事件类型为SourceEventType
Implementation of
params
static
params:ISourceParamas
Defined in: src/source/wcoa.source.ts:94
Accessors
actions
Get Signature
get actions():
ISourceActionInfo
[]
Defined in: src/source/wcoa.source.ts:192
消息源的路由和ws处理器列表,需要在消息源的构造函数阶段创建
Returns
Implementation of
options
Get Signature
get options():
IWCOASourceOptions
Defined in: src/source/wcoa.source.ts:189
初始化过程中的动态参数
Returns
Implementation of
params
Get Signature
get params():
ISourceParamas
Defined in: src/source/wcoa.source.ts:186
这个Source的固有属性,比如source的平台名称
Returns
Implementation of
Methods
getContactDetail()
getContactDetail(
baseInfo
):Promise
<ISourceUserInfo
>
Defined in: src/source/wcoa.source.ts:592
根据获取联系人列表接口返回的粗略信息
Parameters
baseInfo
Returns
Promise
<ISourceUserInfo
>
Implementation of
getContacts()
getContacts(
mode
,force
):Promise
<object
&Partial
<ISourceUserInfo
>[]>
Defined in: src/source/wcoa.source.ts:588
获取用户信息,至少返回nickName
Parameters
mode
all返回全部,user仅返回个人用户,group仅返回群组
"all"
| "user"
| "group"
force
boolean
= false
Returns
Promise
<object
& Partial
<ISourceUserInfo
>[]>
Implementation of
hasLogin()
hasLogin():
boolean
Defined in: src/source/wcoa.source.ts:461
是否是登录状态。仅被用来检查登录状态,未登录不代表出错,也可能是正处于登录中。
Returns
boolean
Implementation of
login()
login():
Promise
<void
>
Defined in: src/source/wcoa.source.ts:468
执行登录,如果有需要扫码等,应发出全局TODO事件,登录成功后发出LOGIN消息,并携带用户信息
Returns
Promise
<void
>
Implementation of
me()
me():
Promise
<ISourceUserInfo
>
Defined in: src/source/wcoa.source.ts:451
获取当前登录用户的个人信息
Returns
Promise
<ISourceUserInfo
>
Implementation of
sendMessage()
sendMessage(
message
,fromMessage?
):Promise
<string
>
Defined in: src/source/wcoa.source.ts:481
发送消息,如果返回内容不为空,说明发送失败
Parameters
message
要发送的消息
fromMessage?
该条消息如果是对某条消息的响应,可以传入原始消息。某些平台可能只允许被动发送消息,此时可能需要用到原始触发回复的那条消息。
Returns
Promise
<string
>