mIRC Autojoin w/ Oper, ZNC Capabilities and Twitch Chat support!

By GrimReaper on Aug 18, 2011

This is the third snippet that I have made that make's setting up your Autojoin easier, It now has Oper Capabilities so that when you connect to a network that you have an oline on you can oper up..

I am looking for new way's to update the code, New things to add to it..

If you have any idea's on what to add to it.. Please let me know in a comment below!

UPDATE: I have added another edit box so you can select which port you would like to connect on.. If you choose to join via SSL, You could need to enter the + as well as the port.. i.e. +6697

Image
The above image is with the Oper button Unchecked.

Image This second image is with it checked and you can see more option's within the dialog.

UPDATE: Updated the dialog look, Made all edit boxes the same size as per Napa's idea, Also fixed an error on the dialog event.

UPDATE: Updated with a useful tool now, So you have the ability to select whether you're using a ZNC connection or not.

UPDATE: I have updated it again to now work with Twitch Chat. So you can connect via mIRC to Twitch. In order to do this, You have to go to http://www.twitchapps.com/tmi and get an oauth key which then goes into the Password box on the Dialog, Include the oauth: portion of this key, Then any channels you want to join. For the server for Twitch, Please use "irc.twitch.tv" otherwise the script will not work as intended. Even tho it connects to "tmi.twitch.tv".

UPDATE: Updated the code slightly to conform with Twitch's new "/raw CAP" to get the membership and commands which you have to send to the server. Thank you Kin for your help on this. :)

menu channel,status,menubar,nicklist {
  AutoJoin/Connect V 3.5:autojoinv3
}

dialog ajoin_dia1 {
  title "mIRC AutoJoin/Connect by Danneh"
  size -1 -1 119 139
  option dbu
  button "Add", 4, 2 124 37 12
  button "Edit", 5, 41 124 37 12
  button "Delete", 6, 80 124 37 12
  box "Networks and Nicks:", 7, 2 2 115 81
  list 8, 5 10 108 69, size
  box "Help", 9, 2 84 115 38
  text "", 10, 4 90 110 29
  menu "File", 1
  item "Exit", 2, 1
  menu "Help", 3
  item "About", 11, 3
}

dialog ajoin_dia2 {
  title "mIRC AutoJoin/Connect by Danneh"
  size -1 -1 119 180
  option dbu
  text "Network:", 1, 3 3 22 8
  text "Server:", 2, 3 14 18 8
  text "Nickname:", 3, 3 36 25 8
  text "NickServ Pass:", 4, 3 47 35 8
  text "Channels:", 5, 3 58 24 8
  check "Auto Identify?", 6, 3 140 50 10
  check "Autojoin Channels?", 7, 3 152 58 10
  button "Add", 8, 3 165 37 12
  button "Ok", 9, 41 165 37 12
  button "Cancel", 10, 79 165 37 12
  edit "", 11, 44 2 73 10
  edit "", 12, 44 13 73 10, autohs
  edit "", 13, 44 35 73 10
  edit "", 14, 44 46 73 10, pass autohs
  edit "", 15, 44 57 73 10, autohs
  check "Do you have an oline on this Network?", 16, 3 69 114 10
  text "Oper UID:", 17, 3 82 25 8, hide
  edit "", 18, 43 81 73 10, hide autohs
  text "Oper Password:", 19, 3 94 39 8, hide
  edit "", 20, 43 93 73 10, hide pass autohs
  text "Port Number:", 21, 3 25 32 8
  edit "", 22, 44 24 73 10, autohs
  check "Are you using a ZNC for the Connection?", 23, 3 105 114 10
  text "ZNC User/Net:", 24, 3 118 35 8, hide
  edit "", 25, 43 117 73 10, hide autohs
  text "ZNC Password:", 26, 3 130 37 8, hide
  edit "", 27, 43 129 73 10, hide pass autohs
}

dialog ajoin_dia3 {
  title "About mIRC AutoJoin/Connect"
  size -1 -1 119 61
  option dbu
  button "Ok", 2, 41 46 37 12
  text "This mIRC AutoJoin/Connect Dialog is the creation of Danneh, This is version 3.5 of the script.. If you can see anything that you would like to see improved within the script.. Please either join irc.GeekShed.net channel: #ReaperCon or #Hell.", 1, 3 3 113 40, center
}

on *:DIALOG:ajoin_dia1:menu:2,11: {
  if ($did == 2) { dialog -x ajoin_dia1 ajoin_dia1 }
  if ($did == 11) { $dialogopen(ajoin_dia3) }
}

on *:DIALOG:ajoin_dia3:sclick:2: {
  dialog -x ajoin_dia3 ajoin_dia3
}

on *:DIALOG:ajoin_dia1:init:*: {
  if ($ini(autojoin.ini,networks,0)) {
    var %a = 1, %z = $ini(autojoin.ini,networks,0)
    while (%a <= %z) {
      did -a $dname 8 $ini(autojoin.ini,networks,%a) - $readini(autojoin.ini,$ini(autojoin.ini,networks,%a),nick)
      inc %a
    }
  }
}

on *:DIALOG:ajoin_dia1:sclick:4-6: {
  if ($did == 4) {
    dialog -x ajoin_dia1 ajoin_dia1
    $dialogopen(ajoin_dia2)
  }
  if ($did == 5) {
    if (!$did($dname,8).sel) { noop $input(Please select a network to edit.,o,Error!) }
    else {
      set %editnetwork on
      set -u10 %ajoinnetsetup $did($dname,8).sel
      dialog -x ajoin_dia1 ajoin_dia1
      $dialogopen(ajoin_dia2)
      did -ra ajoin_dia2 8 Save Edit
      did -a ajoin_dia2 11 $ini(autojoin.ini,networks,%ajoinnetsetup)
      did -a ajoin_dia2 12 $readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),server)
      did -a ajoin_dia2 13 $readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),nick)
      did -a ajoin_dia2 14 $readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),password)
      did -a ajoin_dia2 15 $readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),channels)
      did -a ajoin_dia2 22 $readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),portnum)
      $iif($readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),aidentify) == on,did -c ajoin_dia2 6)      
      $iif($readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),ajoin) == on,did -c ajoin_dia2 7)
      if ($readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),oline) == on) {
        did -c ajoin_dia2 16
        did -v ajoin_dia2 17-20
        did -a ajoin_dia2 18 $readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),UID)
        did -a ajoin_dia2 20 $readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),operpass)
      }
      if ($readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),ZNCConn) == on) {
        did -c ajoin_dia2 23
        did -v ajoin_dia2 24-27
        did -a ajoin_dia2 25 $readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),ZNCUser)
        did -a ajoin_dia2 27 $readini(autojoin.ini,$ini(autojoin.ini,networks,%ajoinnetsetup),ZNCPass)
      }
    }
  }
  if ($did == 6) {
    remini autojoin.ini networks $gettok($did($dname,8).seltext,1,32)
    remini autojoin.ini servers $gettok($did($dname,8).seltext,1,32)
    remini autojoin.ini $gettok($did($dname,8).seltext,1,32)
    did -d $dname 8 $did($dname,8).sel
    noop $input(The selected Network has been deleted.,o)
  }
}

on *:DIALOG:ajoin_dia2:sclick:8-10,16,23: {
  if ($did == 8) {
    if (!$did(11).text) || (!$did(12).text) || (!$did(13).text) || (!$did(14).text) || (!$did(15).text) { noop $input(Please fill in all needed information.,o) }
    else {
      if (%editnetwork) {
        writeini -n autojoin.ini networks $did(11).text $did(11).text
        writeini -n autojoin.ini servers $did(11).text $did(12).text
        writeini -n autojoin.ini $did(11).text server $did(12).text
        writeini -n autojoin.ini $did(11).text nick $did(13).text
        writeini -n autojoin.ini $did(11).text password $did(14).text
        writeini -n autojoin.ini $did(11).text channels $did(15).text
        writeini -n autojoin.ini $did(11).text aidentify $iif($did($dname,6).state == 1,on,off)
        writeini -n autojoin.ini $did(11).text ajoin $iif($did($dname,7).state == 1,on,off)
        writeini -n autojoin.ini $did(11).text oline $iif($did($dname,16).state == 1,on,off)
        writeini -n autojoin.ini $did(11).text ZNCConn $iif($did($dname,23).state == 1,on,off)
        writeini -n autojoin.ini $did(11).text portnum $iif($did(22).text == $null,6667,$did(22).text)
        if ($did($dname,16).state == 1) {
          if ($did(18).text == $null) || ($did(20).text == $null) { noop $input(Please enter a UID and Password for your Oper!,o,Error!) }
          else {
            writeini -n autojoin.ini $did(11).text UID $did(18).text
            writeini -n autojoin.ini $did(11).text operpass $did(20).text
          }
        }
        if ($did($dname,23).state == 1) {
          if ($did(25).text == $null) || ($did(27).text == $null) { noop $input(Please enter Connection Information for your ZNC! $chr(91) $+ Example: User/Net: GrimReaper/DalNet Password: S0m3Cr4zyP455 $+ $chr(93),o,Error!) }
          else {
            writeini -n autojoin.ini $did(11).text ZNCUser $did(25).text
            writeini -n autojoin.ini $did(11).text ZNCPass $did(27).text
          }
        }
        dialog -x ajoin_dia2 ajoin_dia2
        $dialogopen(ajoin_dia1)
        unset %editnetwork
      }
      else {
        writeini autojoin.ini networks $did(11).text $did(11).text
        writeini autojoin.ini servers $did(11).text $did(12).text
        writeini autojoin.ini $did(11).text server $did(12).text
        writeini autojoin.ini $did(11).text nick $did(13).text
        writeini autojoin.ini $did(11).text password $did(14).text
        writeini autojoin.ini $did(11).text channels $did(15).text
        writeini autojoin.ini $did(11).text aidentify $iif($did($dname,6).state == 1,on,off)
        writeini autojoin.ini $did(11).text ajoin $iif($did($dname,7).state == 1,on,off)
        writeini autojoin.ini $did(11).text oline $iif($did($dname,16).state == 1,on,off)
        writeini autojoin.ini $did(11).text ZNCConn $iif($did($dname,23).state == 1,on,off)
        writeini autojoin.ini $did(11).text portnum $iif($did(22).text == $null,6667,$did(22).text)
        if ($did($dname,16).state == 1) {
          if ($did(18).text == $null) || ($did(20).text == $null) { noop $input(Please enter a UID and Password for your Oper!,o,Error!) }
          else {
            writeini autojoin.ini $did(11).text UID $did(18).text
            writeini autojoin.ini $did(11).text operpass $did(20).text
          }
        }
        if ($did($dname,23).state == 1) {
          if ($did(25).text == $null) || ($did(27).text == $null) { noop $input(Please enter Connection Information for your ZNC! $chr(91) $+ Example: User/Net: GrimReaper/DalNet Password: S0m3Cr4zyP455 $+ $chr(93),o,Error!) }
          else {
            writeini autojoin.ini $did(11).text ZNCUser $did(25).text
            writeini autojoin.ini $did(11).text ZNCPass $did(27).text
          }
        }
        dialog -x ajoin_dia2 ajoin_dia2
        $dialogopen(ajoin_dia1)
      }
    }
  }
  if ($did == 9) || ($did == 10) {
    dialog -x ajoin_dia2 ajoin_dia2
    $dialogopen(ajoin_dia1)
  }
  if ($did == 16) {
    if ($did(16).state == 0) { did -h $dname 17-20 }
    if ($did(16).state == 1) { did -v $dname 17-20 }
  }
  if ($did == 23) {
    if ($did(23).state == 0) { did -h ajoin_dia2 24-27 }
    if ($did(23).state == 1) { did -v ajoin_dia2 24-27 }
  }
}

on *:DIALOG:ajoin_dia1:mouse:*: {
  if ($did == 4) { did -ra $dname 10 Use the Add button to start your AutoJoin with Selected Network, Nickname, Channels, Server and your NickServ Password. }
  if ($did == 5) { did -ra $dname 10 Use the Edit button to edit your detail's within the AutoJoin file. It will overwrite previous information. }
  if ($did == 6) { did -ra $dname 10 Use the Delete button to remove a Network that you no longer join or wish to join from your AutoJoin Setup. }
  elseif (!$istok(4|5|6,$did,124)) { did -r $dname 10 }
}

on *:START: {
  if ($ini(autojoin.ini,networks,0)) {
    var %a = 1, %z $ini(autojoin.ini,networks,0)
    while (%a <= %z) {
      $iif(%a == 1,server,server -m) $iif($readini(autojoin.ini,$ini(autojoin.ini,networks,%a),server) != irc.twitch.tv,$+($readini(autojoin.ini,$ini(autojoin.ini,networks,%a),server),:,$readini(autojoin.ini,$ini(autojoin.ini,networks,%a),portnum)) $iif($readini(autojoin.ini,$ini(autojoin.ini,networks,%a),ZNCConn) == on,$+($readini(autojoin.ini,$ini(autojoin.ini,networks,%a),ZNCUser),:,$readini(autojoin.ini,$ini(autojoin.ini,networks,%a),ZNCPass))),$+($readini(autojoin.ini,$ini(autojoin.ini,networks,%a),server),:,$readini(autojoin.ini,$ini(autojoin.ini,networks,%a),portnum)) $readini(autojoin.ini,$ini(autojoin.ini,networks,%a),password) -i $readini(autojoin.ini,$ini(autojoin.ini,networks,%a),nick) -j $lower($readini(autojoin.ini,$ini(autojoin.ini,networks,%a),channels)))
      inc %a
    }
  }
}

on *:CONNECT: {
  if ($server == tmi.twitch.tv) { .raw CAP REQ :twitch.tv/membership twitch.tv/commands }
  if ($ini(autojoin.ini,networks,$network)) { 
    nick $readini(autojoin.ini,$network,nick)
    if ($readini(autojoin.ini,$network,oline) == on) {
      oper $readini(autojoin.ini,$network,UID) $readini(autojoin.ini,$network,operpass)
    }
  }
}
; Anope Services 1
on *:NOTICE:*This nickname is registered and protected.*:?:{
  if ($nick == NickServ) {
    if ($readini(autojoin.ini,$network,aidentify) == on) {
      .msg NickServ identify $readini(autojoin.ini,$network,password)
    }
  }
}
; Anope Services 2
on *:NOTICE:*This nick is owned by someone else. Please choose another.*:?:{
  if ($nick == NickServ) {
    if ($readini(autojoin.ini,$network,aidentify) == on) {
      .msg NickServ identify $readini(autojoin.ini,$network,password)
    }
  }
}
; Atheme Services
on *:NOTICE:*This nickname is registered. Please choose a different nickname*:?:{
  if ($nick == NickServ) {
    if ($readini(autojoin.ini,$network,aidentify) == on) {
      .msg NickServ identify $readini(autojoin.ini,$network,password)
    }
  }
}

on *:NOTICE:*Password accepted*:?:{ 
  if ($nick == NickServ) { 
    if ($readini(autojoin.ini,$network,ajoin) == on) {
      join $readini(autojoin.ini,$network,channels) 
    }
  }
}

RAW 433:*:{ 
  if ($2 == $readini(autojoin.ini,$network,nick)) {
    .msg NickServ GHOST $2 $readini(autojoin.ini,$network,password)
    var %token $network $+ $readini(autojoin.ini,$network,nick)
    if (!$istok(%AJoinNick,%token,32)) {
      .timer 1 1 nick $readini(autojoin.ini,$network,nick)
    }
    set -eu20 %AJoinNick $addtok(%AJoinNick,%token,32)
  }
}

alias -l autojoinv3 { $iif($dialog(ajoin_dia1),dialog -v,dialog -m) ajoin_dia1 ajoin_dia1 }
alias -l dialogopen { dialog $iif($dialog($1),-v,-m $1) $1 }
alias ajoin { return $readini(autojoin.ini,$network,$1) }

Comments

Sign in to comment.
GrimReaper   -  Jul 01, 2015

Updated the code again to sort out the new Twitch /RAW CAP command that you have to send to the server in order for nicknames/usernames to appear in the channel. Thank you to Kin on GeekShed/IdleChat for your help. :)

ovelayer  -  Jul 10, 2015

Could you update it to work with channel keys please?

Sign in to comment

ovelayer   -  Apr 19, 2015

dunno if you saw my comment about it not working if a channel has a key?
anyway to make it work if the channel has a key set?

 Respond  
GrimReaper   -  Apr 01, 2015

I have updated the script again so now if you have a Twitch.tv account, You can login to it via the Dialog. You need an oauth key as stated in the description I have provided the link as well. Hope it works ok for you guys.

@ovelayer The theme I use on my computer is my own creation. I haven't and probably won't release it. I'm just picky like that. lol

ovelayer  -  Apr 01, 2015

ohh that would be evil lol i am in luv with that dark theme..please consider an option to have the dark theme or a way we can change the colors to our personal preference so i can try to make it look like that..it would match my script alot better =)
and thank you for the script in general its awsome!

Sign in to comment

ovelayer   -  Dec 26, 2014

anyway to make it join multiple chan's? some might have keys..
right now i see it can only join 1 chan with the auto

ovelayer  -  Dec 26, 2014

okay so joining multiple chans works you just use a comma to seperate them...that's cool =) but if you try to use a key it won't work
anyway to make it be able to use a key?
also the pic on the top of this thread show's a dark theme...when i installed this i got a normal looking dialog..
how can i get the dark themed one like in the pic?
thanks i really like this auto script =)

Sign in to comment

ovelayer   -  Dec 19, 2014

the code is cut-off at the bottom...
can someone show whole code?

GrimReaper  -  Dec 24, 2014

Sorry about that @ovelayer. It should be sorted now. It was a paste fail on my behalf.

Sign in to comment

Lozo   -  Mar 10, 2014

Very nicely written!

 Respond  
thomasdavid097   -  Mar 01, 2014

yay thanks Peer/GrimReaper <3

 Respond  
GrimReaper   -  Mar 01, 2014

Updated the code a little so now you have the option of selecting whether you're using a ZNC/BNC connection and it'll connect you to that as well as the Oper capability that was added previously. :)

 Respond  
GrimReaper   -  Feb 25, 2014

I will eventually get around to bringing out a larger update on it, Like the use of ZNC connection's and the ability to select whether it's a ZNC or not in the dialog, And setting it up so you can input your Username/Network and Password into it. :)

 Respond  
GrimReaper   -  Feb 25, 2014

Updated a little bit, I made it Auto Identify with Atheme Services as well as Anope.

 Respond  
GrimReaper   -  Aug 23, 2011

Updated the code, Still need to update the screenshot's I have for it tho. lol

 Respond  
GrimReaper   -  Aug 20, 2011

I'll see what I can do about that a little later Napa, I do know what you mean tho.. It has been on my mind as to keep it that way or mod it..

 Respond  
napa182   -  Aug 20, 2011

Maybe make all the edit boxes the same length. They just look odd all different lengths.

 Respond  
Frenetic   -  Aug 20, 2011

The dialog reminds me of xchat's, start up one. Nice work though,

 Respond  
GrimReaper   -  Aug 19, 2011

Updated, Check description.

 Respond  
GrimReaper   -  Aug 18, 2011

If you add the channels to the edit box like

#channel1,#channel2 password,#channel3

It should work. I don't know for certain as none of the channels I am in have a password set on them.

 Respond  
TheWhistler   -  Aug 18, 2011

never mind

 Respond  
GrimReaper   -  Aug 18, 2011

I.. honestly have no idea.. I've not been awake that long >< I might PM Hawkee and see if he can delete the previous one. ><

 Respond  
Jethro   -  Aug 18, 2011

First version on Hawkee: http://www.hawkee.com/snippet/7914/Why didn't you update your first version?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.