Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wechaty
wechaty
提交
2ae6facd
W
wechaty
项目概览
wechaty
/
wechaty
上一次同步 接近 3 年
通知
299
Star
10499
Fork
6
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
152
列表
看板
标记
里程碑
合并请求
1
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wechaty
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
152
Issue
152
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2ae6facd
编写于
5月 01, 2018
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WIP: fix abstract class can not be instanciated...
上级
7ca7400f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
8 deletion
+16
-8
examples/ding-dong-bot.ts
examples/ding-dong-bot.ts
+1
-1
src/puppet/message.ts
src/puppet/message.ts
+8
-1
src/wechaty.ts
src/wechaty.ts
+7
-6
未找到文件。
examples/ding-dong-bot.ts
浏览文件 @
2ae6facd
...
...
@@ -100,7 +100,7 @@ bot
/**
* 2. reply qrcode image
*/
const
imageMessage
=
new
bot
.
Messag
e
(
BOT_QR_CODE_IMAGE_FILE
)
const
imageMessage
=
bot
.
Message
.
creat
e
(
BOT_QR_CODE_IMAGE_FILE
)
log
.
info
(
'
Bot
'
,
'
REPLY: %s
'
,
imageMessage
)
await
m
.
say
(
imageMessage
)
...
...
src/puppet/message.ts
浏览文件 @
2ae6facd
...
...
@@ -67,6 +67,13 @@ export abstract class Message extends PuppetAccessory implements Sayable {
]
}
public
static
create
<
T
extends
Message
>
(
this
:
{
new
(...
args
:
any
[]):
T
},
...
args
:
any
[],
):
T
{
return
new
this
(...
args
)
}
/**
* @private
*/
...
...
@@ -190,7 +197,7 @@ export abstract class Message extends PuppetAccessory implements Sayable {
* if (/^ding$/i.test(m.text())) {
* await m.say('hello world')
* console.log('Bot REPLY: hello world')
* await m.say(new
Messag
e(__dirname + '/wechaty.png'))
* await m.say(new
bot.Message.creat
e(__dirname + '/wechaty.png'))
* console.log('Bot REPLY: Image')
* }
* })
...
...
src/wechaty.ts
浏览文件 @
2ae6facd
...
...
@@ -22,7 +22,7 @@ import * as os from 'os'
import
*
as
semver
from
'
semver
'
import
{
Constructor
,
//
Constructor,
cloneClass
,
instanceToClass
,
}
from
'
clone-class
'
...
...
@@ -113,13 +113,14 @@ export class Wechaty extends PuppetAccessory implements Sayable {
public
readonly
cuid
:
string
// tslint:disable-next-line:variable-name
public
Contact
:
typeof
Contact
&
Constructor
<
{}
>
public
Contact
:
typeof
Contact
//
& Constructor<{}>
// tslint:disable-next-line:variable-name
public
FriendRequest
:
typeof
FriendRequest
&
Constructor
<
{}
>
public
FriendRequest
:
typeof
FriendRequest
//
& Constructor<{}>
// tslint:disable-next-line:variable-name
public
Message
:
typeof
Message
&
Constructor
<
{}
>
public
Message
:
typeof
Message
//
& Constructor<{}>
// tslint:disable-next-line:variable-name
public
Room
:
typeof
Room
&
Constructor
<
{}
>
public
Room
:
typeof
Room
// & Constructor<{}>
// public Room : typeof Room & Constructor<{}>
/**
* get the singleton instance of Wechaty
...
...
@@ -259,7 +260,7 @@ export class Wechaty extends PuppetAccessory implements Sayable {
* @param {WechatyEventFunction} listener - Depends on the WechatyEvent
* @return {Wechaty} - this for chain
*
* More Example Gist: [Examples/Friend-Bot]{@link https://github.com/
wechaty
/wechaty/blob/master/examples/friend-bot.ts}
* More Example Gist: [Examples/Friend-Bot]{@link https://github.com/
Chatie
/wechaty/blob/master/examples/friend-bot.ts}
*
* @example <caption>Event:scan </caption>
* wechaty.on('scan', (url: string, code: number) => {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录