megawac / qwebirc-enhancements

Rich and intuitive browser IRC client.
http://justplay.tf/irc
Other
22 stars 10 forks source link

Pre-fill Autocomplete history #63

Closed krittick closed 9 years ago

krittick commented 9 years ago

From #60:

I really like the autocomplete history feature, but was wondering if there's a way to pre-fill commands? The use case is that we have a bot and would like its common commands to auto-complete right away for users, even if they've never used the commands before.

megawac commented 9 years ago

Would you want this globally or per channel? If so that should be easy -- just set items on app.commandhistory. Note: you may only want to do this the first time the user logins in (tracked via app.settings.get("newb") (true if new user false otherwise)

app.commandhistory.set({
   "#mychan": ["z", "y", "x"]
});

app.set("#otherchan", ["/do thing"])

Setting global items would require reworking and I'm not too keen on that idea (sway me if you want)

krittick commented 9 years ago

Global doesn't really make sense, as bots usually are channel-specific. The only thing I could see it being used for globally is ChanServ/BotServ and those have pretty standardized commands that most IRC users know anyway.

I'll poke at that and see what I can get working. Also, holy moley I cannot wait for the autocomplete bugs to be fixed, not to mention autoconnect. Appreciate the help!

megawac commented 9 years ago

Alright then whats there should work for your needs, ya?

if (app.settings.get("newb")) {
    app.commandhistory.set({
        "#chan": [/*commands*/],
        "#chan2": [/*other stuff*/]
    })
}

I was thinking about auto completing the commands provided by qwebirc but couldn't figure out a good way to template it... something for the future maybe

E.g.

If the user types /a they see /auth <username> <password>