Giter Site home page Giter Site logo

implement menu system about gitterbot HOT 5 CLOSED

dcsan avatar dcsan commented on September 16, 2024
implement menu system

from gitterbot.

Comments (5)

dcsan avatar dcsan commented on September 16, 2024

So i'm looking to change something in the GBot.js.parseInput() function it looks like.
dcsan 09:53
yes
so, we'd need some concept of state
the quick way would be that when you write out a find result
store those links in the GBots state
when someone then enters a single number, look it up in that state list
and show that entry
so that would get us a long way to what we need
BUT it's a bit of a hack, as when we have big scale, we'll get clashes if two people are searching at the same time in different rooms
dting 09:54
we would need a map of user to bot's last user?
err bot's last output for user?
dcsan 09:55
yeah, bots last user or bots by room.
saving state by room would be a good way to do it as later we'll have Room based conversations perhaps more than user based
eg if you and i are chatting to the same bot, in same room, we should be able to continue the conv, rather than have two convs... i think
that's a bit off in the future tho when i add conversation features
dting 09:56
but if two people are looking at different bf's for example, the later one would squash the earlier.
dcsan 09:56
yes, that's true.
i guess in the currrent usecase, overlapping BFs is a more likely scenario
dting 09:57
hmm also need some sort of timeout to cleanup that state.
dcsan 09:57
yes
but if its tied to user, its not too big a deal
so i'd suggest to go in steps, and get the functionality working
then go back and add things like splitting per user / room
since that's a bit complex working with the current GitterHelper API
or maybe not.
i think i added a room id to the input param that every botcommand gets
dting 10:00
okay i'll give it a shot. Haven't looked too deeply at the code yet but this should give me an chance to make myself more familiar.
dcsan 10:00
yep
so you'd setup the state at the end of the find command, that part should be easy
https://github.com/dcsan/gitterbot/blob/master/nap/lib/bot/BotCommands.js#L230-L241
but responding to individual/single characters
probably have to add a new type to the inputParser
https://github.com/dcsan/gitterbot/blob/master/nap/lib/bot/GBot.js#L122-L132
eg check if input.text is a single number
then what you could do is create a new command called "menuItem" and give it the params of whatever the text was, then call that command

from gitterbot.

oab00 avatar oab00 commented on September 16, 2024

oh my god!
I'm sorry I didn't mention that I was working on this one.. was just playing around and thankfully got it working to some extent.
all that conversation would've helped in the implementation maybe, but oh well.

from gitterbot.

dcsan avatar dcsan commented on September 16, 2024

@oab00 no problem! It's great to see someone take this and work on it, its a kind of core feature!

hey I merged in your changes but it doesn't seem to be working for me locally.
it's in master as of commit
e55db51

did i miss a merge, or did something else conflict? can you check again locally?

image

from gitterbot.

dcsan avatar dcsan commented on September 16, 2024

as we chatted you might wanna parseInt the values getting entered by the user, as relying on numbers as named keys in a hashmap (object) is a bit risky!

from gitterbot.

dcsan avatar dcsan commented on September 16, 2024

I think this is done? closing thanks @oab00 !

from gitterbot.

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.