mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2015
Posts: 1
I
Mostly harmless
OP Offline
Mostly harmless
I
Joined: Aug 2015
Posts: 1
I'm trying to make a Twitch bot with no background in coding, I have managed to get the bot setup and get some simple commands working. But I couldn't find any scripts for my particular needs.

Basically I want the bot to take the text from this website and paste it in chat: https://decapi.me/twitch/uptime.php?channel=Icestriker

It's for an uptime command, can anyone help me?

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
If you're lazy about stuff you can use the search function here and find a couple of scripts for this same purpose.

Using a 3rd party to pull information isn't optimal when Twitch has an API on their own, but if you choose to do that then that's up to you. Something you need to use for this is Sockets.
I recommend reading here to learn about sockets.
http://en.wikichip.org/wiki/mirc/sockets/tcp


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Code:
alias icestriker {
  set %icechan $1
  sockopen -e decapi decapi.me 443
}

on *:SOCKOPEN:*: {
  if ($sockname == decapi) {
    sockwrite -nt $sockname GET /twitch/uptime.php?channel=Icestriker HTTP/1.1
    sockwrite -nt $sockname Host: decapi.me
    sockwrite $sockname $crlf
  }
}

on *:SOCKREAD:*: {
  if ($sockname == decapi) {
    var %decapi
    sockread %decapi
    while ($sockbr) {
      sockread %decapi
    }
  }
}

on *:sockclose:*: {
  if ($sockname == decapi) {
    var %decapi
    sockread -f %decapi
    msg %icechan %decapi
  }
}

Tested and works smile Load this on a clear remote. Use /icestriker channelname to send the text to the channel you want. (example: /icestriker #OrF )
-OrFeAsGr-

Last edited by OrFeAsGr; 28/08/15 11:11 PM.

Link Copied to Clipboard