Comments (5)
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.
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.
@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?
from gitterbot.
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.
I think this is done? closing thanks @oab00 !
from gitterbot.
Related Issues (20)
- crash on startup? HOT 9
- uptime monitor HOT 5
- Delete ignored files HOT 1
- nodemon install fails
- Broken wiki links HOT 4
- tighten regex on troll HOT 1
- GA tracking HOT 4
- Multiple thanks to a user with multiple mentions
- stagger room joins
- Bot crashes at startup if no file exists in wiki directory HOT 3
- Update and Explain commands conflict or clash
- Gitterbot's [ Check the map? ] functionality doesn't work properly - needs to be all lower case HOT 2
- Change "Falsey" to "Falsy" for Camperbot in HelpBonfires Section HOT 6
- Internal Wiki Links are not parsed/displayed properly HOT 2
- Remove Plug.dj commands and links HOT 1
- Bot is down in /HelpBonfires - 10/26 HOT 11
- Sort based on brownie points on thank
- Bot reports api offline HOT 2
- explain code command bug HOT 1
- [Feature Request] Big Text Announcements
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gitterbot.