mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2014
Posts: 4
M
Mercury Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jan 2014
Posts: 4
Hello everyone! I've been working on a bot for Twitch.tv and I want to make a few commands subscriber-only.
Basically I have no idea what I'm doing but the small amount of syntax understanding I got from school
helps me through the mIRC Scripting Language. Also I've never really gotten into using iRC that much.
I always use webclients for QuakeNet and that's it, but since our livestream needs a bot now, I'm looking into this wink

If I have some sort of bot command like this:

Code:
on *:TEXT:!hello:#: { msg $chan Hello $nick! How are you? }

How can I restrict this command for non-subscribers?

I already know that I have to use the command "TWITCHCLIENT 2" to receive the status of all viewers in a seperate window named <jtv> and it works.
I can see which viewers are subscribed and which aren't, but how do I use this information in my bot?

Screen of the information I receive whenever someone types something in the iRC\Twitch Chat:
Click to reveal..


I would really appreciate some help!

Greetz,
- Nico

Last edited by Mercury; 18/01/14 03:58 AM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
This will add subscribers from the response to the "subscribers" hash table. Before you send the command, you should clear the table so that users no longer subscribing are removed. Afterward you can see if somebody is a subscriber with $hget(subscribers,$nick)

Code:
alias subscribers.update {
  hfree -w subscribers
  raw TWITCHCLIENT 2
}

on *:text:SPECIALUSER & subscriber:?:{
  if ($nick != jtv) return
  hadd -m subscribers $2 1
}

Joined: Jan 2014
Posts: 4
M
Mercury Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jan 2014
Posts: 4
Thanks! Exactly what I was looking for!

Code:
on *:TEXT:!hello:#: {
  if ($hget(subscribers,$nick) = 1) {
    msg $chan You are a subscriber!
  }
}

Works just fine!

Greetz
- Nico

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Danke! I'll be using this as well smile

It's a damn shame that they don't add which channel the subscriber is in though. Will have to limit this to one partnered channel then.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Jan 2014
Posts: 4
M
Mercury Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jan 2014
Posts: 4
Yeah, too bad.

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Why not add the channel with the nick? U have a hashtable, then use it?


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jan 2014
Posts: 4
M
Mercury Offline OP
Self-satisified door
OP Offline
Self-satisified door
M
Joined: Jan 2014
Posts: 4
What?


Link Copied to Clipboard