Coder Social home page Coder Social logo

Comments (6)

tulir avatar tulir commented on July 17, 2024 1

You're way overthinking things

chatJid = v.Info.Chat

from whatsmeow.

JustSoursop avatar JustSoursop commented on July 17, 2024

You can send a message (SendMessage) into where the chat (jid) coming from.
Chat evt.Info.Chat, the Sender evt.Info.Sender.

// MessageSource contains basic sender and chat information about a message.
type MessageSource struct {
Chat JID // The chat where the message was sent.
Sender JID // The user who sent the message.
IsFromMe bool // Whether the message was sent by the current user instead of someone else.
IsGroup bool // Whether the chat is a group chat or broadcast list.

from whatsmeow.

GonzalezAtWork avatar GonzalezAtWork commented on July 17, 2024

None of those did not worked:

chatJid = types.NewJID(v.Info.Chat, types.DefaultUserServer)

chatJid = types.NewJID(v.Info.Chat.User, types.DefaultUserServer)

chatJid = types.NewJID(v.Info.Chat.Server, types.DefaultUserServer)

This do not give an error, but also did not send any response to the chat:

chatJid = types.NewJID(v.Info.Chat.User +"@" + v.Info.Chat.Server, types.DefaultUserServer)

(ends up with ID@[email protected])

mycli.WAClient.SendMessage(context.Background(), chatJid, response)

from whatsmeow.

JustSoursop avatar JustSoursop commented on July 17, 2024

Maybe need new IDE for editing the code that support LSP.

from whatsmeow.

GonzalezAtWork avatar GonzalezAtWork commented on July 17, 2024

ops, my bad:

chatJid = types.NewJID(v.Info.Chat.User, v.Info.Chat.Server)
this works

but nice to know that there is a simplier solution like you said! Thanks!

from whatsmeow.

JustSoursop avatar JustSoursop commented on July 17, 2024

ops, my bad:

chatJid = types.NewJID(v.Info.Chat.User, v.Info.Chat.Server) this works

but nice to know that there is a simplier solution like you said! Thanks!

Actually, v.Info.Chat is already types.JID and doesn't need to be re-created it.

from whatsmeow.

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.