Giter Club home page Giter Club logo

Comments (6)

ktmud avatar ktmud commented on July 18, 2024

请参考: node-webot/webot-example#3

from weixin-robot.

sang4lv avatar sang4lv commented on July 18, 2024

好的,还有就是现在包含的wechat包貌似不是最新版的。是否能跟新一下?

from weixin-robot.

sang4lv avatar sang4lv commented on July 18, 2024

还有一个问题就是当我有多条图文作为回复时,webot只是随机抽取一个来显示,因为它使用[]来表示随机显示一个。我应该如果在handler里面返回多条图文消息呢?

from weixin-robot.

JacksonTian avatar JacksonTian commented on July 18, 2024

如果你都能拿到底层wechat传上来的req和res。那么res.reply()方法是提供了响应图文消息的方式的。具体参见: https://github.com/node-webot/wechat#回复图文

from weixin-robot.

ktmud avatar ktmud commented on July 18, 2024

@AngelaZou handler 直接定义为一个数组时,会取数组中的随机元素做回复,handler 函数返回数组时,会生成图文回复

区别就在于:

webot.set({
   handler: [
      '文字回复1',
      '文字回复2',
      function(info) {
          return '';
      },
      [{ 图文1 }, { 图文2} ..]
   ]
});

随机回复一个

webot.set({
    handler: function(info) {
        return [{ 图文1 }, { 图文2 }];
    }
})

回复图文列表

from weixin-robot.

sang4lv avatar sang4lv commented on July 18, 2024

好的,这个方法管用了。我发现其实也可以在我原来的内容的外部再套一个数组,这样就是让他随机选择,但是只能选择这一个:)

from weixin-robot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.