These are chat archives for dcsan/gitterbot

3rd
Aug 2015
dc
@dcsan
Aug 03 2015 04:33
help
CamperBot
@camperbot
Aug 03 2015 04:33

Hi this is CamperBot! I can assist you in this chatroom :smile:

Basic commands:

  • find TOPIC find all entries about topic. ex: find js
  • wiki TOPIC show contents of topic page
  • thanks @username send karmapoints to another user
  • about @username shows info on that user
  • bonfire BFNAME info on a bonfire

:unlock: CamperBot info and tips the power of camperbot!

:pencil: read more about camperbot on the FCC Wiki

Timur Uzel
@timurtu
Aug 03 2015 04:36
hi
dc
@dcsan
Aug 03 2015 04:37
hey
Timur Uzel
@timurtu
Aug 03 2015 04:45
wanna work on something else
dc
@dcsan
Aug 03 2015 05:01
@timurtu you know about MDL + meteor ?
ive been using meteor + ionic and hitting some barriers...
Timur Uzel
@timurtu
Aug 03 2015 05:26
yes i do
i actually have an mdl blog
mdlhut.com
dc
@dcsan
Aug 03 2015 05:27
yeah i saw it
interesting
Timur Uzel
@timurtu
Aug 03 2015 05:28
what kinda barriers
dc
@dcsan
Aug 03 2015 05:29
mainly design sense
also page transitions would be nice
Timur Uzel
@timurtu
Aug 03 2015 18:43
have you looked into the tab layouts? they dynamically change content pretty nicely without any extra code
dc
@dcsan
Aug 03 2015 22:31
hi ben
Ben McMahon
@benmcmahon100
Aug 03 2015 22:31
o/
dc
@dcsan
Aug 03 2015 22:31
Hey what's this in utils.js?
\`\[${name}\](${uri})\`
you mean the backticks?
Ben McMahon
@benmcmahon100
Aug 03 2015 22:32
the whole thing
mainly the back ticks though :p
dc
@dcsan
Aug 03 2015 22:33
thats new ES6 syntax
Ben McMahon
@benmcmahon100
Aug 03 2015 22:33
ah okay
dc
@dcsan
Aug 03 2015 22:33
finally catching up with string interpolation
its ugly as butt tho
and even webstorm can't reformat it nicely
so i'm giving up on it
basically its putting names into markdown
Lightwaves
@Lightwaves
Aug 03 2015 22:34
?? that syntax is clunky
dc
@dcsan
Aug 03 2015 22:34
so markdown is [ text ]( uri )
    link = "[" +name + "](" + uri + ")";
is how i have it now
i'll push that to master
coffeescript (or ruby) make this much nicer to write :satisfied:
Ben McMahon
@benmcmahon100
Aug 03 2015 22:36
@dcsan How do you have webstorm set up to work with ES6?
mines not happy at all
dc
@dcsan
Aug 03 2015 22:36
added the linter module
Ben McMahon
@benmcmahon100
Aug 03 2015 22:37
It's not running in harmony either :/
dc
@dcsan
Aug 03 2015 22:40
yeah i know
thats why i was using iojs
but its not worth it
just for those ugly backticks
i'm not using many other ES6 features yet
is io on win yet?
Ben McMahon
@benmcmahon100
Aug 03 2015 22:41
Yep! It always has been i think
Ben McMahon
@benmcmahon100
Aug 03 2015 22:46
Fixed :sunglasses:
dc
@dcsan
Aug 03 2015 22:48
which?
Ben McMahon
@benmcmahon100
Aug 03 2015 22:48
ES6 & iojs
dc
@dcsan
Aug 03 2015 22:48
oh ok
the linter may take longer
Ben McMahon
@benmcmahon100
Aug 03 2015 22:48
also doing pr for dotenv now
dc
@dcsan
Aug 03 2015 22:48
cat .eslintrc 
{
    "rules": {
        "indent": [
            2,
            4
        ],
        "linebreak-style": [
            2,
            "unix"
        ],
        "semi": [
            2,
            "always"
        ],
        "quotes": [0, "double"]
     },
    "env": {
        "es6": true,
        "node": true
    },

    "globals": {
        "describe": false,
        "it": false,
        "__dirname": false
    },

    "ecmaFeatures": {
        "string-templates": true
    }
}%
apart from that its mostly default stuff
that file took me about 4 hours to get to work :cry:
Ben McMahon
@benmcmahon100
Aug 03 2015 22:49
I put ws in ES6 mode and change the node exe to iojs instead
Sheet it just commited instead of making a pr
dc
@dcsan
Aug 03 2015 22:51
not to master it seems
i dont see a commit in the RH menu here
Ben McMahon
@benmcmahon100
Aug 03 2015 22:52
It says i did :/
dc
@dcsan
Aug 03 2015 22:52
dcsan/gitterbot@5576c40
oh yeah
Ben McMahon
@benmcmahon100
Aug 03 2015 22:53
git reset head?
dc
@dcsan
Aug 03 2015 22:53
too late
Ben McMahon
@benmcmahon100
Aug 03 2015 22:54
@dcsan Does it at least work? :/
dc
@dcsan
Aug 03 2015 22:56
➜  nap git:(master) npm install
Error: Cannot find module './lib/tunnel'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:27:14)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
npm ERR! Darwin 14.4.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "install"
npm ERR! node v2.4.0
npm ERR! npm  v2.13.0
npm ERR! code MODULE_NOT_FOUND

npm ERR! Cannot find module './lib/tunnel'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
ill clean
Ben McMahon
@benmcmahon100
Aug 03 2015 22:57
Yeah i didn't add tunnel
dc
@dcsan
Aug 03 2015 22:57
ah thats something to do with my funky n
Ben McMahon
@benmcmahon100
Aug 03 2015 22:58
Yeah it's not in the package
dc
@dcsan
Aug 03 2015 22:58
3 Aug 15:58:09 - [nodemon] starting `iojs app.js`
--------------- startup ------------------
WARN> AppConfig AppConfig.init serverEnv: local
/Users/dc/dev/fcc/gitterbot/nap/lib/bot/KBase.js:56
            if (!name.includes(".md")) {
                      ^
TypeError: undefined is not a function
    at /Users/dc/dev/fcc/gitterbot/nap/lib/bot/KBase.js:56:23
    at Array.forEach (native)
    at Object.KBase.initSync (/Users/dc/dev/fcc/gitterbot/nap/lib/bot/KBase.js:54:37)
    at Object.<anonymous> (/Users/dc/dev/fcc/gitterbot/nap/lib/bot/KBase.js:165:7)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
3 Aug 15:58:10 - [nodemon] app crashed - waiting for file changes before starting...
^C%                                                                                                         ➜  nap git:(master) ✗
Ben McMahon
@benmcmahon100
Aug 03 2015 22:58
Are you using the sh to start?
dc
@dcsan
Aug 03 2015 22:59
no
oh, yeah
so how should i start?
Ben McMahon
@benmcmahon100
Aug 03 2015 22:59
iojs app works for me
includes was an ES6 thing
dc
@dcsan
Aug 03 2015 23:00
➜  nap git:(master) ✗ iojs app.js 
--------------- startup ------------------
WARN> AppConfig AppConfig.init serverEnv: demobot
/Users/dc/dev/fcc/gitterbot/nap/lib/bot/KBase.js:56
            if (!name.includes(".md")) {
                      ^
TypeError: undefined is not a function
    at /Users/dc/dev/fcc/gitterbot/nap/lib/bot/KBase.js:56:23
    at Array.forEach (native)
    at Object.KBase.initSync (/Users/dc/dev/fcc/gitterbot/nap/lib/bot/KBase.js:54:37)
    at Object.<anonymous> (/Users/dc/dev/fcc/gitterbot/nap/lib/bot/KBase.js:165:7)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
true
Ben McMahon
@benmcmahon100
Aug 03 2015 23:00
i got it working by changing my node exe to iojs in ws
like dis
blob
blob
dc
@dcsan
Aug 03 2015 23:01
cool! seems to be working!
Ben McMahon
@benmcmahon100
Aug 03 2015 23:01
Awesome!
I've only change the references in one place is there anywhere else that the env stuff is referenced?
dc
@dcsan
Aug 03 2015 23:02
tried to keep it to AppConfig
but it maybe in some other places still
Ben McMahon
@benmcmahon100
Aug 03 2015 23:02
Really?
dc
@dcsan
Aug 03 2015 23:02
it should not be tho
Ben McMahon
@benmcmahon100
Aug 03 2015 23:03
I just changed passportModule.js
dc
@dcsan
Aug 03 2015 23:03
oh
var AppConfig = {
clientId: process.env.GITTER_APP_KEY,
token: process.env.GITTER_USER_TOKEN,
passportModule was stuff from gitter i haven't cleaned up
Ben McMahon
@benmcmahon100
Aug 03 2015 23:04
I'm not sure how that's working :p
dc
@dcsan
Aug 03 2015 23:04
those are things being passed in
what did you add for env?
Ben McMahon
@benmcmahon100
Aug 03 2015 23:04
require('dotenv').load();
at the start of passport
.env is in nap
hmmm
dc
@dcsan
Aug 03 2015 23:05
so .env is the credentials-demobot.sh ?
those are getting passed in i guess then
Ben McMahon
@benmcmahon100
Aug 03 2015 23:05
just added
require('dotenv').load();
to the config and it made no difference
yeah .env acts as all the credential stuff
The nice thing is that all the vars are accessed the same way
dc
@dcsan
Aug 03 2015 23:07
right
its a bit cleaner than passing them in
so how do you swap which env?
you just swap that file out?
Ben McMahon
@benmcmahon100
Aug 03 2015 23:07
Well it removes the dependency on .sh scripts working
dc
@dcsan
Aug 03 2015 23:07
yeah
Ben McMahon
@benmcmahon100
Aug 03 2015 23:07
no just add this to as high in the app as possible or where needed
require('dotenv').load();
dc
@dcsan
Aug 03 2015 23:08
i dont see it there right now?
are you sure that maybe .env isn't just picked up by node ?
Ben McMahon
@benmcmahon100
Aug 03 2015 23:08
It's only in passport now
I'm gonna move it
dc
@dcsan
Aug 03 2015 23:09
put it in the app
Ben McMahon
@benmcmahon100
Aug 03 2015 23:09
Done will i push it?
dc
@dcsan
Aug 03 2015 23:09
then also that file should not be in the repo
make a branch :)
so .gitignore the .env
and create a
.env-EXAMPLE
with info on where to copy/rename it
make sure that one IS in the repo
Ben McMahon
@benmcmahon100
Aug 03 2015 23:10
Why not leave it there if it's the default anyway?
dc
@dcsan
Aug 03 2015 23:10
because when other people put their creds in there and check it in
they just shared keys with the world
files with keys in should always be ignored
Ben McMahon
@benmcmahon100
Aug 03 2015 23:10
okay will do
dc
@dcsan
Aug 03 2015 23:11
the way i have it setup right now i can just run as different people easily by sourceing a differntcredentials-X.sh`
like passing params
Ben McMahon
@benmcmahon100
Aug 03 2015 23:11
Yeah the default env thing is a good idea
dc
@dcsan
Aug 03 2015 23:11
maybe tere's a way to run the app and tell it which .env to use ...
Ben McMahon
@benmcmahon100
Aug 03 2015 23:12
It'll use .env
so if you change the name i wont load
@dcsan Moved those changes to DotEnv branch will i revert master?
dc
@dcsan
Aug 03 2015 23:16
nope master is ok
Ben McMahon
@benmcmahon100
Aug 03 2015 23:16
Okey doke!
dc
@dcsan
Aug 03 2015 23:16
lets fix this up so we're happy with it and build up the app from there
so i'll have to figure out if there's a way to switch envs, thats the only thing
you and one other person are working as "demobot" atm
but it seems to work ok
Ben McMahon
@benmcmahon100
Aug 03 2015 23:17
Eh
we can have the default env
like you had said and just have the instructions to set people up themselfs
@dcsan Or just Make a new room for each person
or dm the person
with dms being entire rooms and all that
dc
@dcsan
Aug 03 2015 23:21
DMs arent working yet
Ben McMahon
@benmcmahon100
Aug 03 2015 23:22
Can it not just join a room like https://gitter.im/benmcmahon100
dc
@dcsan
Aug 03 2015 23:22
yeh
edit RoomData.js
Ben McMahon
@benmcmahon100
Aug 03 2015 23:22
and have a constant env
dc
@dcsan
Aug 03 2015 23:22
based on botname it will join other rooms
Ben McMahon
@benmcmahon100
Aug 03 2015 23:23
and have an empty env var called room that you have to fill out
dc
@dcsan
Aug 03 2015 23:23
yeah but the room has to exist
bot can't creat room
CamperBot
@camperbot
Aug 03 2015 23:23
no wiki entry for: cant creat room
:pencil: click here to create one now!after creating your page type update to reload it here
dc
@dcsan
Aug 03 2015 23:23
bot status
CamperBot
@camperbot
Aug 03 2015 23:23
no wiki entry for: status
:pencil: click here to create one now!after creating your page type update to reload it here
dc
@dcsan
Aug 03 2015 23:23
botstatus
CamperBot
@camperbot
Aug 03 2015 23:23
All bot systems are go!
botVersion: 0.0.5b
env: prod
botname: camperbot
Ben McMahon
@benmcmahon100
Aug 03 2015 23:23
I think dm rooms are auto create server side
dc
@dcsan
Aug 03 2015 23:24
someone has to click sth afaik
my guess is they dont want bots spamming people with DMs
Ben McMahon
@benmcmahon100
Aug 03 2015 23:24
You can do chat privately on the bot
dc
@dcsan
Aug 03 2015 23:25
yeah it should work
Ben McMahon
@benmcmahon100
Aug 03 2015 23:25
testing now
dc
@dcsan
Aug 03 2015 23:25
what i want to get going is that when a new user DMs you (starts a new chat)
the bot would pick that up and add to its list of rooms
but i need to find the GH API event for something like "got new DM" or "added to 1:1 room"
Ben McMahon
@benmcmahon100
Aug 03 2015 23:27
@dcsan
blob
totes works :p
Can you get the bot to send a dm as a command? @dcsan
dc
@dcsan
Aug 03 2015 23:29
there was a discuess in gitterHQ/developers
Ben McMahon
@benmcmahon100
Aug 03 2015 23:30
So like a command that joins a room on the fly
like
talk to me @camperbot
dc
@dcsan
Aug 03 2015 23:30

@dcsan I think you can't create another chat type
@dcsan
and there is no API for "whispering" to people?
blob
like slackbots "only you can see this message"
blob
is this the best channel to ask about these type of things?
the API and creating bots?
there doesn't seem to be any gitterHQ folks in here.
@dcsan
@mydigitalself is there a way to whisper from the API, ie just talk to one user?
or use the /me emote to grey format a message
@dcsan
@dcsan demonstrates wot i mean
@mydigitalself
we don't have whisper as a concept, so there wouldn't be an API for it
but you can create a 1:1 chat with someone, yes
a 1:1 chat is effectively a room, so just join the room with the URL of that user
@dcsan
is there an event when a user sends you a DM?
since events seem only for rooms you're already listening to.
i'm not sure how to listen to events that are tied to the User or system, like "new DM received" or "new room created"
currently I just poll the list of rooms and look for new oneToOne rooms, but this seems not optimal.
@mydigitalself
@dcsan the best way to do that is using Faye (https://developer.gitter.im/docs/faye-endpoint)

we actually have an undocumented gitter-realtime-client that we will be officially supporting soon and may be best for you to take a look at that.
https://github.com/gitterHQ/realtime-client

Ben McMahon
@benmcmahon100
Aug 03 2015 23:30
then it would join gitter.im/benmcmahon100
and send hi
dc
@dcsan
Aug 03 2015 23:31
yeah
there's a bot.say()
you could call on startup maybe
tho you have to get a room object to pass to it
i'm only doing that the other way around
Ben McMahon
@benmcmahon100
Aug 03 2015 23:31
Can you change rooms on the fly?
dc
@dcsan
Aug 03 2015 23:31
ie when called from gitter, i get a room object
no, you're listening to all rooms at the same time
Ben McMahon
@benmcmahon100
Aug 03 2015 23:32
what's this do then?
demobot: [
        {
            title: "demobot",
            name: "benmcmahon100",
            icon: "star",
            topics: ["getting started"]
        }
    ]
dc
@dcsan
Aug 03 2015 23:32
says which rooms to join and listen to
you'll see camperbot signs up for other rooms
Ben McMahon
@benmcmahon100
Aug 03 2015 23:33
Okay so can that be change on the fly
dc
@dcsan
Aug 03 2015 23:33
nope
thats read at startup
Ben McMahon
@benmcmahon100
Aug 03 2015 23:33
like can you push to the array?
ahh okay
dc
@dcsan
Aug 03 2015 23:33
but you could call the same code that does, with a differnt array
Ben McMahon
@benmcmahon100
Aug 03 2015 23:34
That'll make camperbot dump all rooms and rejoin no?
dc
@dcsan
Aug 03 2015 23:34
GBot.init
no you could add i guess
Ben McMahon
@benmcmahon100
Aug 03 2015 23:34
Will do!
dc
@dcsan
Aug 03 2015 23:34
        RoomData.rooms().map(function(oneRoomData) {
            var roomUrl = oneRoomData.name;
            // clog("oneRoomData", oneRoomData);
            // clog("gitter.rooms", that.gitter.rooms);
            that.gitter.rooms.join(roomUrl, function(err, room) {
RoomData.rooms is that data above
that.gitter
is a bit tricky tho
but if called in bot context you should have what you need.
so the bot can join a room
Ben McMahon
@benmcmahon100
Aug 03 2015 23:36
so this is bot in that context
dc
@dcsan
Aug 03 2015 23:36
but just atm i don't know how to listen for messages from rooms it didnt know about
yes
Ben McMahon
@benmcmahon100
Aug 03 2015 23:36
like the bot that's passed in commands?
dc
@dcsan
Aug 03 2015 23:36
basically yep
Ben McMahon
@benmcmahon100
Aug 03 2015 23:36
AWESOME!
dc
@dcsan
Aug 03 2015 23:36
its a bit hacky. as
bot = Bot
CamperBot
@camperbot
Aug 03 2015 23:36
no wiki entry for: bot
:pencil: click here to create one now!after creating your page type update to reload it here
dc
@dcsan
Aug 03 2015 23:36
shaddap bot
Ben McMahon
@benmcmahon100
Aug 03 2015 23:36
Hacky is my middle name
dc
@dcsan
Aug 03 2015 23:36
var    Bot  = { ... 
also look at
    joinRoom: function(opts, announceFlag) {
        var roomUrl = opts.roomObj.name;

        GBot.gitter.rooms.join(roomUrl, function(err, room) {
in that case i just used the global GBot
so LMK when you're confident with your changes to .env
i need to setup production based on that change
@benmcmahon100 can you send me a PR?
Ben McMahon
@benmcmahon100
Aug 03 2015 23:42
@dcsan Do you have a link to the demo room?
Ben McMahon
@benmcmahon100
Aug 03 2015 23:43
The DotEnv branch should be good to go
dc
@dcsan
Aug 03 2015 23:44
k
Ben McMahon
@benmcmahon100
Aug 03 2015 23:57
Hey @dcsan once a command is in BotCommands how is it added as something that should be listened for?