GithubHelp home page GithubHelp logo

Comments (7)

rampatra avatar rampatra commented on August 24, 2024

Hi,

You chain methods in a conversation so when a method is invoked then all the methods in the line to which it was chained would have been invoked already one after the other.

So, why you want to keep track of whats being said earlier. Can you please give a use case?

from jbot.

mboujonnier avatar mboujonnier commented on August 24, 2024

There are a lot of usecases... considering your example (scheduling a meeting), in a real project, I would probably create a Schedule object to handle the schedule and at each step of the conversation, I will update it so I need a way to retrieve it. So store it in the conversation as a cache would be simple.

Then, when fully populated, I may store it in a DB or whatever.

from jbot.

rampatra avatar rampatra commented on August 24, 2024

You can update your Schedule object inside each controller method. Why do you need to retrieve your conversation?

from jbot.

mboujonnier avatar mboujonnier commented on August 24, 2024

How do you retrieve the Schedule object ? They can be plenty.... so yes I implemented my own conversation class to store all stuff saved from a conversation between a bot and a user. But so now I have duplicate code...

    @Controller(events = {EventType.DIRECT_MENTION, EventType.DIRECT_MESSAGE}, pattern = "create meeting", next = "setMeetingName")
    public void createMeeting(WebSocketSession session, Event event) 
    {
        startConversation(event, "setMeetingName");   // start conversation
        Conversation conv = new Conversation(session.getId());
        conversations.put(conv.getId(), conv);

        reply(session, event, new Message("With pleasure, what's the meeting name ?"));
    }

from jbot.

rampatra avatar rampatra commented on August 24, 2024

Nope. We can discuss further on gitter. That would be better I suppose.

from jbot.

sigrist avatar sigrist commented on August 24, 2024

What was the resolution for this issue? I'm having the same question here, but I couldn't find anything in the documentation and I can't join the gitter channel to search the discussion.

from jbot.

rampatra avatar rampatra commented on August 24, 2024

@sigrist You can follow a similar approach as @mboujonnier did. You can have an object to store session and pass it around the conversation methods.

from jbot.

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.