Skip to content

Commit

Permalink
support to set puppet token when initializing wechaty (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Jun 19, 2018
1 parent 5d380f1 commit 4da13db
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/puppet-padchat/puppet-padchat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class PuppetPadchat extends Puppet {

const manager = this.padchatManager = new PadchatManager({
memory : this.options.memory,
token : padchatToken(),
token : this.options.token || padchatToken(),
endpoint : WECHATY_PUPPET_PADCHAT_ENDPOINT,
})

Expand Down
1 change: 1 addition & 0 deletions src/puppet/schemas/puppet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type PuppetEventName = keyof typeof PUPPET_EVENT_DICT
export interface PuppetOptions {
memory : MemoryCard,
timeout? : number,
token? : string,
}

export interface Receiver {
Expand Down
6 changes: 4 additions & 2 deletions src/wechaty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ export const WECHATY_EVENT_DICT = {
export type WechatyEventName = keyof typeof WECHATY_EVENT_DICT

export interface WechatyOptions {
puppet? : PuppetName | Puppet,
profile? : null | string,
profile? : null | string,
puppet? : PuppetName | Puppet,
puppetToken? : string,
}

/**
Expand Down Expand Up @@ -503,6 +504,7 @@ export class Wechaty extends Accessory implements Sayable {

const options: PuppetOptions = {
memory : this.memory,
token : this.options.puppetToken,
}

return new MyPuppet(options)
Expand Down

0 comments on commit 4da13db

Please sign in to comment.