Quick Sleep Noobie Question

28 views
Skip to first unread message

Alistair Shepherd

unread,
Feb 2, 2014, 3:31:01 PM2/2/14
to sleep-de...@googlegroups.com
Hi, I'm trying to use Sleepybot as an IRC bot for my IRC channel, as sleep looked a pretty easy scripting language I could get my head around, being pretty much a noob when it comes to programming/scripting. What I want to do is when someone says "!nowplaying" in the channel is to output the text in the url "thetcabxl.accudio.com:8000/currentsong", which displays the current playing song on my shoutcast radio station. I've read the documentation and tried to do it myself using openf and readln, but I'm really not sure how to do it.
Thanks in advance if you can help,
Alistair "Accudio" Shepherd

Ralph Becker

unread,
Feb 6, 2014, 12:43:00 PM2/6/14
to sleep-de...@googlegroups.com

Hi,  use the connect function:
  $socket = connect('thetcabxl.accudio.com',8000);
Then you can write to $socket, for example:
  println($socket,'GET /currentsong HTTP/1.1');
  println($socket,'Host: thetcabxl.accudio.com');
  print($socket,"\r\n");
and read from $socket
  @response = readAll($socket);

This code should be a starting point for you.

Ralph

Alistair Shepherd

unread,
Feb 6, 2014, 8:22:05 PM2/6/14
to sleep-de...@googlegroups.com
Thanks so much! Got it working flawlessly using the pop function.
Cheers!
Accudio
Reply all
Reply to author
Forward
0 new messages