Giter Club home page Giter Club logo

Comments (14)

anaivebird avatar anaivebird commented on July 17, 2024 1

Group ding dong succeeded!

how to tell Room.say from Contact.say, since QQ group number and QQ account number can be same?
Have you got the solutions to it? Our current design in Puppet API is using a conversationId for both contact and room.

Currently, the puppet will check if conversationId is in bot account's added group list. If bot has join group of conversationId, it will send the message to the group. Otherwise, a private message will be sent to qq of conversationId.
image

from puppet-oicq.

anaivebird avatar anaivebird commented on July 17, 2024 1

The code looks good, I believe the problem of that qq and group number can be same can be solved with our latest version of the code.

I think the problem is of course solved with this commit, because we dispatch private and group message send by prefix group_ or qq_

https://github.com/wechaty/puppet-oicq/blob/main/src/puppet-oicq.ts#L237-L249

from puppet-oicq.

huan avatar huan commented on July 17, 2024

messageSendText(conversationId, text) is using for both Contact.say and Room.say.

Please refer to the below example code and feel free to let me know your questions by replying to this issue.

Send room message code example

  1. Wechaty Room source code at here
  2. Puppet Wechaty messageSendText source code at here

from puppet-oicq.

anaivebird avatar anaivebird commented on July 17, 2024

how to tell Room.say from Contact.say, since QQ group number and QQ account number can be same?

from puppet-oicq.

anaivebird avatar anaivebird commented on July 17, 2024

roomRawPayload and roomRawPayloadParser has been implemented, and room name of a room message could be shown in terminal.

17:47:11 INFO StarterBot Message#Text[🗣Contact<Li Dao>@👥Room<内部测试群>]      ding
17:47:11 VERB Message say(dong)
17:47:11 VERB Puppet selfId()
17:47:11 VERB Puppet selfId()
17:47:11 VERB Message mentionList()
17:47:11 VERB Message mentionList() text = "ding", mentionNameList = "[]"
17:47:17 VERB Message static load(LaGHkzKIqqUAAAAunlM4/2Fr8SUB)
17:47:17 VERB Message constructor(LaGHkzKIqqUAAAAunlM4/2Fr8SUB) for class WechatifiedMessage
17:47:17 VERB Message ready()
17:47:17 VERB Puppet messagePayload(LaGHkzKIqqUAAAAunlM4/2Fr8SUB)
17:47:17 VERB Room ready()
17:47:17 VERB Puppet selfId()
17:47:17 INFO StarterBot Message#Text[🗣Contact<Li Dao>@👥Room<内部测试群>]      asdf

from puppet-oicq.

anaivebird avatar anaivebird commented on July 17, 2024

If someone say message in group, and he is not a friend of the bot. contactRawPayload could not find contact info from this.contactStore.

To fix this problem. We will add a person's info to this.contactStore after he says something in group if he is not a friend of bot.

from puppet-oicq.

huan avatar huan commented on July 17, 2024

how to tell Room.say from Contact.say, since QQ group number and QQ account number can be same?

Have you got the solutions to it? Our current design in Puppet API is using a conversationId for both contact and room.

roomRawPayload and roomRawPayloadParser has been implemented, and room name of a room message could be shown in terminal.

That's great, good job!

To fix this problem. We will add a person's info to this.contactStore after he says something in the group if he is not a friend of the bot.

My suggestion is to use the puppet.roomMemberPayload related API for contact payloads who are not friends of the bot but in a QQ group / WeChat room. You can refer to the WeChat Web puppet at here

from puppet-oicq.

huan avatar huan commented on July 17, 2024

Congratulations!

Could you please help us to confirm the QQ account provided by @krapnikkk can work with our QQ ding/dong bot?

If we can have the QQ account worked, then I believe we can try to integrate our Friday BOT with QQ soon!

Currently, the puppet will check if a conversation is in the bot account's added group list. If the bot has joined the group of conversationId, it will send the message to the group. Otherwise, a private message will be sent to QQ of conversationId.

It's a good workaround. I hope we can find a way to deal with it better in the future.

from puppet-oicq.

huan avatar huan commented on July 17, 2024

I reopen this issue because we need to improve the puppet code to better deal with the oicq protocol.

According to this link, the QQ number and the group number might be exactly the same.

This is a challenge of our current puppet design: we are using a conversationId for sending messages to, which means we need to differentiate the number of QQ and the Group.

For example, we can add a prefix to achieve that:

  1. qq_xxx means qq user number
  2. group_xxx means qq group number

We can do the conversion inside the puppet-oicq from and to the OICQ.

Please feel free to let me know if you have any questions and good ideas.

from puppet-oicq.

anaivebird avatar anaivebird commented on July 17, 2024

Got it. I try to change to this pattern, a problem is:
If someone says ding on Group, puppet will be called with conversationId=qq_xxx in messageSendText, and bot will send dong to this people by private message instead of in group, is it expected?

from puppet-oicq.

anaivebird avatar anaivebird commented on July 17, 2024

I found that if we use ding-dong bot of wechaty-getting-started, bot will reply dong on QQ group.

Because it called msg.say('dong')

If we use run the puppet directly, bot will reply dong to the person in private message, for it called await puppet.messageSendText(msgPayload.fromId!, 'dong')

from puppet-oicq.

anaivebird avatar anaivebird commented on July 17, 2024

I reopen this issue because we need to improve the puppet code to better deal with the oicq protocol.

According to this link, the QQ number and the group number might be exactly the same.

This is a challenge of our current puppet design: we are using a conversationId for sending messages to, which means we need to differentiate the number of QQ and the Group.

For example, we can add a prefix to achieve that:

  1. qq_xxx means qq user number
  2. group_xxx means qq group number

We can do the conversion inside the puppet-oicq from and to the OICQ.

Please feel free to let me know if you have any questions and good ideas.

I think commit ae0053e has implemented all of these. And [email protected] is released.

fromId and roomId has been changed as asked above.

{"fromId":"qq_1962099319","id":"dPNCdwAAAAll+k9fYXPYZQE=","text":"Wechaty login","timestamp":1634981990088,"type":7,"toId":"qq_1962099319"}
{"fromId":"qq_847817381","id":"LaGHkzKIqqUAAABWzeCF12Fz2GcB","text":"ding","timestamp":1634981991493,"type":7,"roomId":"group_765560723"}

from puppet-oicq.

huan avatar huan commented on July 17, 2024

The code looks good, I believe the problem of that qq and group number can be same can be solved with our latest version of the code.

from puppet-oicq.

huan avatar huan commented on July 17, 2024

Of course.

Thank you very much for the clarifying!

from puppet-oicq.

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.