Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.www.
wechaty
提交
6d63e894
W
wechaty
项目概览
.www.
/
wechaty
与 Fork 源项目一致
Fork自
wechaty / wechaty
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wechaty
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6d63e894
编写于
10月 16, 2016
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
doc typo fix & code clean
上级
5cb8afd4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
33 deletion
+16
-33
README.md
README.md
+6
-5
example/ding-dong-bot.ts
example/ding-dong-bot.ts
+8
-15
src/puppet-web/event.ts
src/puppet-web/event.ts
+2
-2
src/puppet-web/puppet-web.ts
src/puppet-web/puppet-web.ts
+0
-4
src/room.ts
src/room.ts
+0
-7
未找到文件。
README.md
浏览文件 @
6d63e894
...
...
@@ -37,7 +37,7 @@ Thanks.
## Voice of the Developer
> @
G
asLin : it may be the best wecaht sdk i have seen in github! [link](https://github.com/wechaty/wechaty/issues/8#issuecomment-228971491)
> @
J
asLin : it may be the best wecaht sdk i have seen in github! [link](https://github.com/wechaty/wechaty/issues/8#issuecomment-228971491)
> @Jarvis : 目前用过的最好的微信开发库 [link](http://weibo.com/3296245513/Ec4iNp9Ld?type=comment)
...
...
@@ -546,10 +546,10 @@ message.set('content', 'Hello, World!')
## Contact Class
### Contact.name(): string
`Contact`
is
`Sayable`
### Contact.name(): string
### Contact.ready(): Contact
A Contact may be not fully initialized yet. Call
`ready()`
to confirm we get all the data needed.
...
...
@@ -586,9 +586,10 @@ contact.get('name')
## Class Room
Doc is cheap, show you code:
[
Example/Room-Bot
](
https://github.com/wechaty/wechaty/blob/master/example/room-bot.js
)
`Room`
is
`Sayable`
Doc is cheap, show you code:
[
Example/Room-Bot
](
https://github.com/wechaty/wechaty/blob/master/example/room-bot.js
)
### Room.say(content: string, replyTo: Contact|Contact[]): Promise<void>
say
`content`
inside Room.
...
...
@@ -837,7 +838,7 @@ Github Issue <https://github.com/wechaty/wechaty/issues>
# Contributing
*
Lint: eslint
```
bash
$
npm lint
$
npm
run
lint
```
*
Create an issue, fork, then send a pull request(with unit test please).
...
...
example/ding-dong-bot.ts
浏览文件 @
6d63e894
...
...
@@ -50,26 +50,19 @@ bot
console
.
log
(
`
${
url
}
\n[
${
code
}
] Scan QR Code in above url to login: `
)
})
.
on
(
'
message
'
,
m
=>
{
m
.
ready
()
.
then
(
msg
=>
{
const
room
=
m
.
room
()
const
from
=
m
.
from
()
console
.
log
((
room
?
'
[
'
+
room
.
topic
()
+
'
]
'
:
''
)
+
'
<
'
+
from
.
name
()
+
'
>
'
try
{
console
.
log
((
m
.
room
()
?
'
[
'
+
m
.
room
().
topic
()
+
'
]
'
:
''
)
+
'
<
'
+
m
.
from
().
name
()
+
'
>
'
+
'
:
'
+
m
.
toStringDigest
()
)
// log.info('Bot', 'recv: %s', msg.toStringEx())
// logToFile(JSON.stringify(msg.rawObj))
if
(
/^
(
ding|ping|bing
)
$/i
.
test
(
m
.
get
(
'
content
'
))
&&
!
bot
.
self
(
m
))
{
bot
.
reply
(
m
,
'
dong
'
)
.
then
(()
=>
{
log
.
warn
(
'
Bot
'
,
'
REPLY: dong
'
)
}
)
m
.
say
(
'
dong
'
)
log
.
info
(
'
Bot
'
,
'
REPLY: dong
'
)
}
})
.
catch
(
e
=>
log
.
error
(
'
Bot
'
,
'
ready: %s
'
,
e
))
}
catch
(
e
)
{
log
.
error
(
'
Bot
'
,
'
on(message) exception: %s
'
,
e
)
}
})
bot
.
init
()
...
...
src/puppet-web/event.ts
浏览文件 @
6d63e894
...
...
@@ -21,7 +21,7 @@ import {
}
from
'
../config
'
import
Contact
from
'
../contact
'
import
{
Message
Message
,
MediaMessage
}
from
'
../message
'
import
log
from
'
../brolog-env
'
...
...
@@ -31,7 +31,7 @@ import PuppetWeb from './puppet-web'
/* tslint:disable:variable-name */
const
PuppetWebEvent
=
{
onBrowserDead
onBrowserDead
,
onServerLogin
,
onServerLogout
...
...
src/puppet-web/puppet-web.ts
浏览文件 @
6d63e894
...
...
@@ -13,10 +13,6 @@
* Class PuppetWeb
*
*/
// const util = require('util')
// const fs = require('fs')
// const co = require('co')
import
{
// Config
ScanInfo
...
...
src/room.ts
浏览文件 @
6d63e894
...
...
@@ -14,7 +14,6 @@ import Config from './config'
import
Contact
from
'
./contact
'
import
Message
from
'
./message
'
import
UtilLib
from
'
./util-lib
'
// import EventScope from './event-scope'
import
log
from
'
./brolog-env
'
...
...
@@ -54,12 +53,6 @@ export class Room extends EventEmitter {
constructor
(
public
id
:
string
)
{
super
()
log
.
silly
(
'
Room
'
,
`constructor(
${
id
}
)`
)
// this.id = id
// this.obj = {}
// this.dirtyObj = {}
// if (!Config.puppetInstance()) {
// throw new Error('Config.puppetInstance() not found')
// }
}
public
toString
()
{
return
this
.
id
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录