Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wechaty
wechaty
提交
43565ebe
W
wechaty
项目概览
wechaty
/
wechaty
上一次同步 大约 3 年
通知
304
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,发现更多精彩内容 >>
提交
43565ebe
编写于
9月 03, 2016
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code clean up
上级
2c8f4d0b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
16 deletion
+12
-16
bin/io-bot.js
bin/io-bot.js
+5
-6
src/config.js
src/config.js
+4
-4
src/io-bot.js
src/io-bot.js
+3
-6
未找到文件。
bin/io-bot.js
浏览文件 @
43565ebe
...
...
@@ -29,16 +29,15 @@ let token = Config.token
if
(
!
token
)
{
log
.
error
(
'
Bot
'
,
'
token not found: please set WECHATY_TOKEN in environment before run io-bot
'
)
// process.exit(-1)
token
=
'
DEMO
'
token
=
'
TEST
'
log
.
warn
(
'
Bot
'
,
`set token to "
${
token
}
" for demo purpose`
)
}
else
{
console
.
log
(
welcome
)
log
.
info
(
'
Bot
'
,
'
Starting for WECHATY_TOKEN: %s
'
,
token
)
}
console
.
log
(
welcome
)
log
.
info
(
'
Bot
'
,
'
Starting for WECHATY_TOKEN: %s
'
,
token
)
const
ioBot
=
new
IoBot
({
profile
:
Config
.
profile
||
Config
.
DEFAULT_PROFILE
,
token
token
,
log
})
...
...
src/config.js
浏览文件 @
43565ebe
...
...
@@ -6,10 +6,10 @@ Object.assign(Config, {
,
head
:
process
.
env
.
WECHATY_HEAD
||
Config
.
DEFAULT_HEAD
,
puppet
:
process
.
env
.
WECHATY_PUPPET
||
Config
.
DEFAULT_PUPPET
,
endpoint
:
process
.
env
.
WECHATY_ENDPOINT
||
Config
.
ENDPOINT
// wechaty.io api endpoint
,
port
:
process
.
env
.
WECHATY_PORT
||
0
// 0 for disable port
,
profile
:
process
.
env
.
WECHATY_PROFILE
// DO NOT set to
DEFAULT_PROFILE, because sometimes user do not want to save session
,
token
:
process
.
env
.
WECHATY_TOKEN
// DO NOT set to
DEFAULT, because sometimes user do not want to connect to io cloud service
,
port
:
process
.
env
.
WECHATY_PORT
||
0
// 0 for disable port
,
profile
:
process
.
env
.
WECHATY_PROFILE
||
''
// DO NOT set
DEFAULT_PROFILE, because sometimes user do not want to save session
,
token
:
process
.
env
.
WECHATY_TOKEN
||
''
// DO NOT set
DEFAULT, because sometimes user do not want to connect to io cloud service
})
module
.
exports
=
Config
.
default
=
Config
.
Config
=
Config
src/io-bot.js
浏览文件 @
43565ebe
...
...
@@ -9,12 +9,11 @@
* https://github.com/zixia/wechaty
*
*/
const
Wechaty
=
require
(
'
./wechaty
'
)
const
{
Wechaty
}
=
require
(
'
./wechaty
'
)
class
IoBot
{
constructor
({
token
=
'
EPP
'
,
profile
=
'
wechaty-epp
'
token
,
log
=
Wechaty
.
log
})
{
if
(
!
log
)
{
...
...
@@ -30,15 +29,13 @@ class IoBot {
throw
e
}
this
.
token
=
token
this
.
profile
=
profile
}
init
()
{
this
.
log
.
verbose
(
'
IoBot
'
,
'
init()
'
)
const
wechaty
=
this
.
wechaty
=
new
Wechaty
({
profile
:
this
.
profile
profile
:
Config
.
DEFAULT_PROFILE
,
token
:
this
.
token
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录