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

怎么切换默认的Puppet呢,默认没配置使用的PuppetWechat4u #2682

Open
aqpmzngldh opened this issue Apr 29, 2024 · 5 comments
Open

Comments

@aqpmzngldh
Copy link

怎么切换默认的Puppet呢,默认没配置使用的PuppetWechat4u,但是PuppetWechat4u满足不了我想要的自动同意入群邀请功能,我想要切换成PuppetPadchat 或者PuppetPadPro,我尝试了一下,一直有报错

Copy link

dosubot bot commented Apr 29, 2024

To switch from PuppetWechat4u to a different puppet in your Wechaty project, it's important to note that PuppetPadchat and PuppetPadPro are deprecated and no longer supported. Instead, consider using a supported puppet like wechaty-puppet-service. Here's how you can switch:

  1. Install the new puppet package, for example:

    npm install wechaty-puppet-service

    or

    yarn add wechaty-puppet-service
  2. Update your Wechaty instance to use the new puppet:

    const { Wechaty } = require('wechaty');
    const bot = new Wechaty({
      puppet: 'wechaty-puppet-service',
      // Add other options if needed
    });

Ensure any specific configurations required by the new puppet are correctly set up as per its documentation.

For the feature of automatically accepting group invitations, this is supported by the Wechaty SDK and should work with any supported puppet, leveraging the accept method within the RoomInvitationMixin class.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@aqpmzngldh
Copy link
Author

To switch from PuppetWechat4u to a different puppet in your Wechaty project, it's important to note that PuppetPadchat and PuppetPadPro are deprecated and no longer supported. Instead, consider using a supported puppet like wechaty-puppet-service. Here's how you can switch:

  1. Install the new puppet package, for example:

    npm install wechaty-puppet-service

    or

    yarn add wechaty-puppet-service
  2. Update your Wechaty instance to use the new puppet:

    const { Wechaty } = require('wechaty');
    const bot = new Wechaty({
      puppet: 'wechaty-puppet-service',
      // Add other options if needed
    });

Ensure any specific configurations required by the new puppet are correctly set up as per its documentation.

For the feature of automatically accepting group invitations, this is supported by the Wechaty SDK and should work with any supported puppet, leveraging the accept method within the RoomInvitationMixin class.

Details

To continue the conversation, mention @dosu.

根据文档我这个默认的4u很多功能都不支持,于是想要更换

3.3 Puppet 微信群接口

Room API | 描述 | PuppetWechat4u & PuppetPuppeteer | PuppetPadchat & PuppetPadPro | PuppetIosbird -- | -- | -- | -- | -- Permanent RoomPayload.id | 唯一群id | No | Yes | Yes roomQrcode() | 获取群二维码 | No | Yes | Yes roomCreate() | 创建微信群 | No | Yes | Yes roomAdd() | 邀请好友入群 | No | Yes | Yes roomDel() | 将用户踢出群聊 | No | Yes | Yes roomQuit() | 主动退群 | No | Yes | Yes roomAnnounce() | 发群公告 | No | Yes | Yes roomPayload.owner | 获取群主信息 | No | Yes | No roomInvitaition | 自动接受群邀请 | No | Yes

Copy link

dosubot bot commented Apr 29, 2024

To switch your Wechaty puppet to wechaty-puppet-service and leverage features like automatically accepting group invitations, follow these steps:

  1. Generate a Wechaty Puppet Service Token if you don't have one. This can be done via the command line with wechaty token generate.

  2. Use WechatyBuilder to create your bot instance with the wechaty-puppet-service:

import { WechatyBuilder } from 'wechaty';

const token = 'your_wechaty_puppet_service_token_here'; // Replace with your actual token

const wechaty = WechatyBuilder.build({
  name: 'YourBotName',
  puppet: 'wechaty-puppet-service',
  puppetOptions: {
    token: token,
  },
});

wechaty.start()
  .then(() => console.log('Bot started.'))
  .catch((error) => console.error('Bot failed to start:', error));
  1. Implement features such as creating groups, inviting friends to groups, and automatically accepting group invitations. For automatically accepting group invitations, listen for 'room-invite' events and call roomInvitation.accept() to accept the invitation.

This setup requires Wechaty version >=1.19.8. Ensure you replace 'your_wechaty_puppet_service_token_here' with your actual token. This approach will help you utilize the full capabilities of Wechaty with the wechaty-puppet-service, including features not supported by PuppetWechat4u.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@aqpmzngldh
Copy link
Author

import { WechatyBuilder } from 'wechaty';

我使用import { WechatyBuilder } from 'wechaty';的时候不配置token也能使用呀,还有就是有没有其他免费的呢,要不然token都要收费长时间用不起@dosu.

Copy link

dosubot bot commented Apr 29, 2024

You can indeed use WechatyBuilder from 'wechaty' without specifying a token, allowing for basic operations with Wechaty. This approach is useful for development or trial purposes, as seen in the Wechaty documentation and examples.

Regarding free alternatives for using Wechaty without a subscription-based token, while the official documentation might not explicitly list free services, you can generate a temporary, "insecure" token using the wechaty token generate command. This token can serve for trial or development but might not be suitable for production environments due to potential limitations or restrictions.

For generating and using this token, specific conditions or requirements must be met, such as specifying the puppet provider and ensuring internet accessibility. These details are crucial for successfully integrating and using the token with your Wechaty bot.

If you're looking for a more permanent, free solution for a Wechaty puppet service, it's worth exploring community resources or asking within the Wechaty community for recommendations. The community might offer insights into alternative setups or providers that could meet your needs without incurring costs.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

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

No branches or pull requests

1 participant