Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING CHANGE v0.16 Contact, FriendRequest, Message, and Room classes will not be able to instantiate directly #1364

Closed
lijiarui opened this issue Jun 19, 2018 · 4 comments

Comments

@lijiarui
Copy link
Member

lijiarui commented Jun 19, 2018

Duplicated with #1217

Before

import { Contact } from 'wechaty'
const contact = await Contact.find({name: '李佳芮'})

import { Room } from 'wechaty'
const roomList = await Room.findAll()

const room = await Room.create(contactList, roomTopic)

After

import { Wechaty } from 'wechaty'

const wechaty = Wechaty.instance()

const contact = await wechaty.Contact.find({name: '李佳芮'})

const roomList = await wechaty.Room.findAll()

const room = await wechaty.Room.create(contactList, roomTopic)

Or, it may get error log as follows:

Error: static puppet not found for Room
    at Function.get puppet [as puppet] (/Users/jiaruili/git/xiaoju-bot/node_modules/wechaty/src/accessory.ts:54:11)
    at Function.<anonymous> (/Users/jiaruili/git/xiaoju-bot/node_modules/wechaty/src/user/room.ts:123:37)
    at Generator.next (<anonymous>)
    at /Users/jiaruili/git/xiaoju-bot/node_modules/wechaty/dist/src/user/room.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/jiaruili/git/xiaoju-bot/node_modules/wechaty/dist/src/user/room.js:23:12)
    at Function.findAll (/Users/jiaruili/git/xiaoju-bot/node_modules/wechaty/dist/src/user/room.js:123:16)
    at Function.<anonymous> (/Users/jiaruili/git/xiaoju-bot/node_modules/wechaty/src/user/room.ts:150:33)
    at Generator.next (<anonymous>)
    at /Users/jiaruili/git/xiaoju-bot/node_modules/wechaty/dist/src/user/room.js:27:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/jiaruili/git/xiaoju-bot/node_modules/wechaty/dist/src/user/room.js:23:12)
    at Function.find (/Users/jiaruili/git/xiaoju-bot/node_modules/wechaty/dist/src/user/room.js:149:16)
    at Function.<anonymous> (/Users/jiaruili/git/xiaoju-bot/src/bot/room-add.ts:33:34)
    at Generator.next (<anonymous>)
    at /Users/jiaruili/git/xiaoju-bot/src/bot/room-add.ts:7:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/jiaruili/git/xiaoju-bot/src/bot/room-add.ts:3:12)
    at matchList.forEach (/Users/jiaruili/git/xiaoju-bot/src/bot/room-add.ts:31:46)
    at Array.forEach (<anonymous>)
    at Function.<anonymous> (/Users/jiaruili/git/xiaoju-bot/src/bot/room-add.ts:31:17)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/jiaruili/git/xiaoju-bot/src/bot/room-add.ts:4:58)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)

See: #1161

@huan
Copy link
Member

huan commented Jun 19, 2018

  1. Breaking change is very rare and there's no need to create a new issue tag for it. Please remove and clean it
  2. Please add the version to the title, as I had already replied you in the other issue.

@lijiarui lijiarui changed the title BREAKING CHANGE Contact, FriendRequest, Message, and Room classes will not be able to instantiate directly BREAKING CHANGE v0.16 Contact, FriendRequest, Message, and Room classes will not be able to instantiate directly Jun 19, 2018
@lijiarui
Copy link
Member Author

lijiarui commented Jun 19, 2018

When I migration from puppeteer to puppet-padchat, I found more than 17 breaking changes now. This number will increase these days.

If we have this label, maybe it will make it easier for developers to find break changes.

At least, I think this label should keep for a while when alpha test is finished. Then I will remove and clean it.

@huan
Copy link
Member

huan commented Jun 19, 2018

At least, I think this label should keep for a while when alpha test is finished. Then I will remove and clean it.

OK.

@huan
Copy link
Member

huan commented Jul 3, 2018

Merge to #1217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants