mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2015
Posts: 112
B
Blas Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
I am writing a custom mIRC bot for a friend of mine on Twitch. My goal is to only have one copy of mIRC open, yet have two Twitch accounts logged on to the Twitch server. I am aware that I can use "/server -m" in my script to log on both accounts. The issue that I am having is that all of my scripts end up working on both accounts, as I cannot figure out a simple way to tell mIRC to only run all of the scripts on the BOT's account, rather than the secondary account. Both accounts are logged on to the Twitch server, so using "if $server" does not work. If possible, I would rather not have to edit all of my scripts to get this to work, as I would imagine there's a simpler way that I can not think of.

Any help would be greatly appreciated. Thanks.

The reason that I want to do this is to create a simple script for real-time "host alerts." I have been able to do this by running two copies of mIRC and having the streamer account whisper the BOT account, and then having the BOT convert the whisper into a "User is now hosting the channel" message. As I mentioned, I am trying to provide the same function by only running one copy of mIRC. Using the Twitch API is not ideal, as it is not "real time" like the message in the chat that the streamer receives when a host occurs.

Joined: Sep 2014
Posts: 52
Babel fish
Offline
Babel fish
Joined: Sep 2014
Posts: 52
The only way I can think of is using the account's name to discern between the 2. Replace STREAMERNAME & BOTNAME below with your appropriate twitch account names
Code:
ON *:CONNECT: {
  if ($me == STREAMERNAME) {
    set %Streamer $cid
  }
  elseif ($me == BOTNAME) {
    set %MyBot $cid
  }
}

Then in your scripts you would need a check for which server to react upon.
Code:
if ($cid == %MyBot) {
  do stuff
}

Joined: Oct 2015
Posts: 112
B
Blas Offline OP
Vogon poet
OP Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
I really don't want to have to edit all the scripts in the bot, but I'll be testing this method out tomorrow if no one else has any better suggestions. Thank you for your help. smile

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Just check $me in that event you use to recieve messages about hosting.


Dont give a fish - teach to fish!
Joined: Sep 2014
Posts: 52
Babel fish
Offline
Babel fish
Joined: Sep 2014
Posts: 52
The reason why I suggested setting cid's is because I assumed he wanted to message the channel using the bot's account. Using this method he could capture the privmsg from jtv about a new host on the streamer's account, then easily /scid %MyBot and message the channel using the bot's account. In either case all the events would have to be edited to prevent double posting, would they not? I may be wrong here.

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Only channel owner recieves priv msgs about being hosted, and then he wants to whisper from his streaming account to his bot account. Not as perfect as it can be, but no need to re-write old part.


Dont give a fish - teach to fish!

Link Copied to Clipboard