« first day (2 days earlier)      last day (301 days later) » 

2:49 PM
@DannyBeckett did you figure out the invalid message business? because I have :P it is stupid
@PatoSáinz watch your step there Pato
 
@rlemon I believe it's because the max length is >500 including links?
 
@DannyBeckett the bot ignores herself, so all messages from the bot are invalid in her eye. running the bot locally you have to stop ignoring yourself.
 
Do you have a solution?
I tried args.directreply(output.length < 500 ? output : 'Sorry, the weather data retrieved was > 500 characters (the max allowed) - I\'ll fix this tomorrow - try another airport!');
but still got the error
 
that is another issue
 
I'm speculating it's because bot.adapter.link doesn't factor into the .length calculation
var output = '**' + link + ':** ' + resp.our_airport.name + ' \u2022 ' + text[mode];
link = bot.adapter.link(code, 'http://aviationweather.gov/adds/metars/?station_ids=' + resp.our_airport.icao + '&std_trans=translated&chk_metars=on&hoursStr=most+recent+only&chk_tafs=on&submi‌​tmet=Submit');
@rlemon
 
2:53 PM
there was an open issue about this stuff in the issue list
i'm looking for it now, not sure what Zirak did with it
 
thanks man
source code for the command available here: github.com/dannybeckett/SO-ChatBot/blob/master/source/plugins/…
@rlemon ah, you were asking about the parseMessage invalid issue, initially?
I've just been seeing Server error (status 500) occured (message probably too long) messages - thought you were referring to that
Yeah I sorted that out... you're right, you have to disable self-ignore
 
3:20 PM
or enter dev mode
 
Anonymous
@rlemon yes?
 
19 hours ago, by Pato Sáinz
JS ROOM? EWWWWW
blasphemy!!
 
Anonymous
the only truth!
 
bullshit.
@rlemon don't suppose you found an issue?
 
 
7 hours later…
10:28 PM
hey
 
@DannyBeckett: Okay :)
 
so the server in both cases is dannybeckett.co.uk
standard ports
just changing the password for SSH from my own personal password so we can share it
username's aviationbot
 
okay, sounds good
 
ok, ready for the password?
gonna send it here, then delete straight away
 
10:30 PM
shoot
got it
 
it's the same login for both SSH and FTP
if you login to FTP first, I can tell you how it's organised
you only need SSH to restart the bot
 
well, I just logged in via ssh.. it works. :)
 
which you need to do after each edit to any file
 
no reload command for the bot?
 
well while you're there
cd dev
 
10:32 PM
there
 
just logging in myself, 1 sec
so if you run ls
you'll see the same as what's in FTP
the commands are stored in...
 
yeah, I'm quite familiar with the command line... :)
 
~/dev/SO-ChatBot/source/plugins
ok great
but you're gonna FTP them anyway
the command you want to restart with is actually re load
there are a few in ~/dev
 
Aww, I can't just edit on your server? ;-)
 
you can
by all means
 
10:35 PM
Okay, that's easier for me.. I'll keep proper backups. :)
 
ok great!
you just hit the nail on the head btw
 
(I've used "vi" for WAY too long, but at least it makes it easy for me.)
 
you remember I said it bitches at every turn?
 
yup
 
if there's a syntax error in your code, it spits out a dump of all the code and dies
so yeah, keep backups :)
(when you try to reload the bot)
 
10:36 PM
nice, so how do we test it before we try to reload the "real" bot?
Here?
 
no it's ok to reload
nobody notices :p
 
haha
 
on that note, vi ~/dev/reloadpjs.sh
vim, not run
you'll need reload, not restart
(it rebuilds the solution)
 
okay, good
 
so you need to comment out the SCREEN line
whilst logged into SSH
oh shit, that's in another file actually
SO-ChatBot/startpjs.sh
don't move the files either, they're in a specific place for certain things to work
made a mistake
so-chatbot-driver/startpjs.sh
so you're gonna want to comment out the if [ -z $1 ]; then export SCREENCMD="screen -mdS so-chatbot-driver"; fi; line with a #
let me know when you've done that
with it commented, you see the output of the bot to the console
including details of syntax errors etc
also, we can restart it and you'll see what it does
when you've commented that out, you can run ~/dev/reloadpjs.sh
 
10:42 PM
okay, I'm back. They kicked me off of the free internet here at the airport.
 
Fortunately all of your messages are still here.
 
yeah thats good
 
Do you have it open now?
It's complaining and wants me to open read-only. :)
 
yeah you can try now
 
10:43 PM
k
 
(had to update the password in the script)
 
Okay, that's commented out.
 
ok so :wq
then ../reloadpjs.sh
 
Okay, I just reloaded
 
you see the output?
 
10:45 PM
yeah, it's logging in now
 
eventually you should see Running...
 
there
!!weather ewr
 
at that point you can start hitting the room with commands like this
 
@lnafziger EWR/KEWR: Newark Liberty International Airport • Observed: 55 mins ago • Wind: 270°/W @ 18kts • Visibility: 10.0mi/16.09km • Sky (AGL): Few clouds @ 5,000ft • Temperature: -12.8°C/9°F • Dewpoint: -24.4°C/-12°F • Pressure: 30.27" Hg/1,025mb • Conditions: VFR
 
!!info
 
10:45 PM
@DannyBeckett I awoke on Tue, 07 Jan 2014 22:45:11 GMT (that's about 26 seconds ago), got invoked 1 times, learned 1 commands
 
ok great - it usually takes longer after saying it's running
so let's get you setup with a template for a command
1 sec
 
(I'm trying to fly out of EWR right now, lol)
 
you can go ahead and create a new file called something.js in ~/dev/SO-ChatBot/source/plugins
 
And that's all that we need to add a new command?
 
@lnafziger lol, visibility's good at least
 
10:47 PM
-13!!
 
"at least"
:p
 
!!info
 
@lnafziger I awoke on Tue, 07 Jan 2014 22:45:11 GMT (that's about 2 minutes ago), got invoked 2 times, learned 1 commands, teleported 97 goats
 
@lnafziger not quite
just getting you a template made up quickly
 
okay
 
okay, how about far.js
 
wait, 1 sec on that pastebin
yeah far.js sounds good
 
ok
 
use this one instead pastebin.com/r5zxpQmH
ah shit 1 more thing
just remove , mode from the function declaration
command: function(args, cb)
 
done
 
10:52 PM
ok cool
edit every instance of weather to far
 
and I assume change var weather to var far, etc.
got it
 
exactly ;)
 
is it case sensitive?
 
it is
use lower
 
I did... I hate that though, lol.
 
10:53 PM
not sure on the parsing side, lets try
 
Is there a way to setup an alias so that far or FAR works?
 
!!WEATHER JFK
 
@DannyBeckett JFK/KJFK: John F Kennedy International Airport • Observed: 3 mins ago • Wind: 280°/W @ 16kts • Visibility: 10.0mi/16.09km • Sky (AGL): Few clouds @ 5,000ft • Temperature: -12.2°C/10°F • Dewpoint: -23.9°C/-11°F • Pressure: 30.29" Hg/1,026mb • Conditions: VFR
 
ah ok so it works in the chat at least
 
guess we don't need to. :)
 
10:54 PM
it's just the variable names that are case sensitive, to JavaScript
 
cool
 
so once you've edited those to far, reload the bot
when you run !!far xxx it should reply something
 
logging in
!!far FLL
 
@lnafziger something
 
cool :)
you're gonna want to remove the restriction on length at the top
 
10:56 PM
yeah, I can work that out.
 
if(!query)
essentially, you need data in JSONP
not just JSON, but JSONP
the easiest way to do that is with PHP
 
So what's the issue with that? Why can't we use JSON (or any other format)?
 
!!wiki cross origin resource sharing
 
Cross-origin resource sharing (CORS) is a mechanism that allows JavaScript on a web page to make XMLHttpRequests to another domain, not the domain the JavaScript originated from. It is more useful than only allowing same-origin requests, but it is more secure than simply allowing all such cross-origin requests. How CORS works The CORS standard works by adding new HTTP headers that allow servers to serve resources to permitted origin domains. Browsers support these headers and enforce the restrictions they establish. Additionally, for HTTP request methods that can cause side-effects on user...
 
it's something specific to JS
basically, it's a "security concern"
however, all hope is not lost
JSONP is just JSON with callback( on one side, and ) on the other
also, I've written a script to convert XML -> JSONP
this is where your next login comes in, 1 moment
 
10:59 PM
okay
 
username is aviationphp - password is the same
 
Same server?
 
oh, one more thing before we get to that.
 
ah nice, you just got /
apparently I can't give you SSH to that dir
 
11:02 PM
When I want to logoff and leave the bot running...?
 
maybe if I add you to that group
ok, that's where the comment comes in on startpjs.sh
obviously if you wanna quit it, currently, you do Ctrl+C
 
Okay, so I un-comment it and then run it? In the background or does it do that automatically?
 
to have it run in the background, uncomment
yeah
 
Okay, got it
 
personally I keep it commented, so I can see the output
you can always open 2 instances
 
11:04 PM
yeah, that's what I have now
 
ok great
 
just wondering about when I'm done for the day.
 
you need to go?
 
not yet
 
11:05 PM
okay, so aviationphp
 
yeah but it aint working
just added the user to the other group, maybe that will work, trying myself now
 
yeah, that's better
 
still getting an error
 
well, then again...
I can't ls, (although the error at login went away)
 
I still see the error
trying to get you into another user's home dir (mine)
I added it to the secondary group - will try primary
ok that worked :)
ah shit still not write-access though
maybe FTP is... lets see
 
11:09 PM
oh, probably because I just "su"'d to the user instead of creating a new ssh session
man, they have crappy internet here.
 
nope. sigh
actually, tell you what, I'll just give you my login
make this easier
there's nothing on my website anyway
just gonna change the pass
so forget aviationphp - 2nd login is dannybeckett
same password, same everything else
 
okay, got it
 
relevant files are in ~/public_html/AviationBot
you can create PHP helper files here
e.g.
in the simplest form, <?php echo $_GET['callback'] . '(' . $someJSONdata . ')'; ?>
Airport.php is an example of how to screenscrape
Weather.php is an example of XML -> JSONP
 
I'm looking at Weather now
cool
 
it probably looks more complex than it is
 
11:16 PM
curl, huh? I used that in an iOS project awhile back... Fun fun.
 
because it also calls Airport.php
so the output looks odd
 
Actually, I was about to say that it looks pretty straight-forward.
 
oh great!
in terms of the final line though, the whole reason for the substring is just to append inside the JSON object
(with data from Airport.php - this is the IATA support)
so... yeah.. you can create anything, so long as it outputs JSONP
are you familiar with php?
if so, you can simply do json_encode($anObject)
 
Okay, anything else major to show me? I think I can figure most of it out now.
and I'm using internet through my cell phone now, so it isn't the speediest, lol.
 
then wrap $_GET['callback'] . '(' and ')' around it
nope that's all!
just remember to wrap any JSON in that
otherwise it won't work
:)
above all, keep backups and don't forget to uncomment startpjs and run when you're logging out
feel free to give me a shout if you get stuck!
you can play with JavaScript either in F12 -> Console in Chrome
 
11:21 PM
nice
 
JS is a nice language
easy to learn
PHP less so (lol)
 
I've used a little PHP, and it isn't SO bad.
 
ok that's definitely a positive!
as I say, feel free to give me a shout
 
But I'm wanting to learn JS anyway, so I'll probably stick with that for now.
Sounds good, thanks for setting this up!
 
I seem to be in The Hangar every day now
no problem man!
thanks for the help :)
 
11:23 PM
It will probably be a little while before I can do any real work on it... I'll play with it plenty in time though. :)
 
of course ;)
I'd rather be flying than coding
one last thing: there's a 500 char limit on messages
which I just discovered when trying to get the weather for MIA
!!weather mia
bot down?
!!info
guess so..
hmm, looks like it's running from ps aux | grep java @lnafziger
 
!!info
 
@lnafziger I awoke on Tue, 07 Jan 2014 23:27:07 GMT (that's about 1 minute ago), learned 1 commands
 
I just stopped it and ran it in the background
 
!!listcommands
 
11:28 PM
@DannyBeckett help, listen, eval, coffee, refresh, forget, info, listcommands, tell, afk, ban, unban, convert, define, far, findcommand, google, inhistory, learn, no, live, die, meme, metar, nudge, parse, spec, stat, stats, summon, unsummon, timer, todo, undo, user, weather, welcome, wiki, youtube (page 0/0)
 
so what happens when you go over 500 characters?
 
ah ok, guess it was still logging in
that's what I'm trying to figure out now
 
!!weather MIA
 
@lnafziger MIA/KMIA: Miami International Airport • Observed: 36 mins ago • Wind: 350°/N @ 5kts • Visibility: 10.0mi/16.09km • Sky (AGL): Overcast @ 2,000ft • Temperature: 13.3°C/56°F • Dewpoint: 9.4°C/49°F • Pressure: 30.25" Hg/1,024mb • Conditions: MVFR
 
ok MIA got shorter suddenly
yesterday, by Otto the Autopilot
Server error (status 500) occured (message probably too long)
 
11:29 PM
lol
Of course it did
 
working on a solution atm
 
!!weather EWR
 
I just wanna split the message
 
@lnafziger EWR/KEWR: Newark Liberty International Airport • Observed: 39 mins ago • Wind: 270°/W @ 18kts • Visibility: 10.0mi/16.09km • Sky (AGL): Few clouds @ 5,000ft • Temperature: -12.8°C/9°F • Dewpoint: -24.4°C/-12°F • Pressure: 30.29" Hg/1,026mb • Conditions: VFR
 
but having trouble detecting when it's > 500 chars with output.length because you insert a link, like so:
 
11:30 PM
yeah, probably good
 
var link = bot.adapter.link(code, 'http://aviationweather.gov/adds/metars/?station_ids=......
then you add it to the output, e.g. var output = '**' + link + ':** ' + resp.our_airport.name + ' ' + text;
and I don't think bot.adapter.link adds to .length
because this doesn't fire:
args.directreply(output.length < 500 ? output : 'Sorry, the weather data retrieved was > 500 characters (the max allowed) - I\'ll fix this tomorrow - try another airport!');
anyways, I'll leave you to it for now!
will let you know on the 500 chars issue
 
Okay, thanks. Talk to you soon!
 
(I guess the 500 max includes formatting)
cheers buddy. talk soon!
 
(Yeah, I'm sure that it does... It might be a SE limit, like on comments)
 
it is
seeya :)
hope you're not waiting round too long
 
11:34 PM
Oh, and what do you think about removing the @user from the beginning of the messages since it it showing in a public room anyway?
 
could do, you use args.send() for that
instead of args.directreply()
but I think it's useful, because you know what it's replying to then (e.g. if a couple of people are using it at the same time, or you're a 3rd-party wondering why it's saying that)
I think the standard is to use args.directreply()
that tells you the various args.functions
there's also some other useful info in the wiki section
 
Okay, just a thought to shorten it since people will see the request and then the response pretty quickly... Maybe we should leave it though.
 
I'll get it to split the messages, don't worry
in the case of FARs, since some are really long, you could truncate instead, and link to the full FAR
 

« first day (2 days earlier)      last day (301 days later) »