basic commands for mIRC

By Yawhatnever on Jun 15, 2013

This script allows you to more easily connect to twitch through mIRC and provides the basic moderation commands from via right click popup menus.

To join a chat:
/twitch channelname

A account is required to connect. Your username and password will be requested and stored by the script the first time you use the /twitch command. If you need to change nicknames or passwords later, read the directions in the comments of the script.

As of September 2013 Twitch requires you to connect to chat using an OAuth token. You can still use this script, however you must set your password with this script as oauth:token
You can generate a token here for now:

  • Note that generating a new token will invalidate the old one.

Notable features:

  • Moderation commands via context menu items.
  • Capability for joins, mods, parts, and notices are requested on connect. (twitch doesn't send them by default anymore)
  • Join and part messages are hidden in channels with over 10 users.
  • CLEARCHAT (timeout and ban) messages are displayed in the source channel
  • Extra messages from tmi are hidden.

mIRC 7.34 or later is required for this script (due to $servertarget).

For general mIRC scripting help: /server -m 6667 -j #mSL

* To join a channel, type /twitch <channel>
* To change your default nickname, type /twitch_nick <nickname>
* To change a password for a nickname, type /twitch_pass <nickname> [pass]
* (password is optional; if left blank it will be deleted)

* Right click inside the channel window for moderation commands.
* Right click usernames for modding/banning/timeout
* Written by Yawhatnever (Travis) #mSL
* Free to use and modify as long as this comment remains attached.

alias -l TWITCH_CONNECT_PORT return 6667

on *:start:{
  if ($version < 7.34) {
    echo -sc info * Notice: $qt($script) requires mIRC version 7.34 or greater and has been unloaded.
    noop $input($qt($script) requires mIRC 7.34 or greater and has been unloaded., o)
    unload -rs $qt($script)
on ^*:join:*:if ($is_twitch($cid)) && ($nick(#, 0) > 10) haltdef
on ^*:part:*:if ($is_twitch($cid)) && ($nick(#, 0) > 10) haltdef
on *:connect:{
  if ($is_twitch($cid)) {
  if ($is_twitch($cid)) {
    if ($2 == $null) {
      echo -tc info2 $1 * Chat cleared by a moderator
    else {
      echo -tc kick $1 * Messages cleared: $2
raw USERSTATE:*:if ($is_twitch($cid)) haltdef
raw ROOMSTATE:*:if ($is_twitch($cid)) haltdef
raw HOSTTARGET:*:if ($is_twitch($cid)) haltdef
raw GLOBALUSERSTATE:*:if ($is_twitch($cid)) haltdef
alias twitch {
  var %name $twitch_nick
  if (%name) var %pass $twitch_pass(%name)
  tokenize 32 $lower($iif($1, $1, %name))
  if (!%name) || (!%pass) {
    echo -aec info * /twitch: name or pass missing.
  var %cid $twitch_connection
  if (%cid) && ($scid(%cid).status != connected) scid %cid server $TWITCH_CONNECT_ADDRESS $TWITCH_CONNECT_PORT %pass -i %name -j #$1
  elseif (%cid) scid %cid join #$1
  else server -m $TWITCH_CONNECT_ADDRESS $TWITCH_CONNECT_PORT %pass -i %name -j #$1
menu nicklist {
  $iif($is_twitch($cid), Twitch)
  .Mod: .msg # .mod $1
  .Demod: .msg # .unmod $1
  .Ban: .msg # .ban $1
  .Unban: .msg # .unban $1
  .Go to channel: url -an $+ $$1
  $iif($is_twitch($cid), Timeout)
  .Purge (1sec): .msg # .timeout $1 1
  .5min: .msg # .timeout $1 300
  .10min: .msg # .timeout $1 600
  .30min: .msg # .timeout $1 1800
  .120min: .msg # .timeout $1 7200
menu channel {
  $iif($is_twitch($cid), Twitch)
  .Slow chat .msg # .slowoff
  ..10sec: .msg # .slow 10
  ..30sec: .msg # .slow 30
  ..60sec: .msg # .slow 60
  ..120sec: .msg # .slow 120
  ..on: .msg # .r9kbeta .msg # .r9kbetaoff
  ..30sec: .msg # .commercial 30
  ..60sec: .msg # .commercial 60
  ..90sec: .msg # .commercial 90
  ..120sec: .msg # .commercial 120
  ..150sec: .msg # .commercial 150
  ..180sec: .msg # .commercial 180
  ..on: .msg # .subscribers .msg # .subscribersoff
  .Clear chat: .msg # .clear
  .Mod list: .msg # .mods
  .Open stream: url -an $+ $right(#, -1)
alias twitch_pass {
  * $twitch_pass(NICK)
  * returns the pass for NICK

  * /twitch_pass NICK PASS
  * sets the pass for NICK as PASS
  * if PASS is left $null, removes the pass saved for NICK
  if ($isid) {
    if ($0 > 0) {
      var %pass $readini(twitch.ini, n, PASS, $1)
      if (!%pass) {
        var %pass $input(Twitch chat auth key for $1:, p)
        if (%pass) {
          writeini twitch.ini PASS $1 %pass
          echo -ac info2 * Twitch password changed for $1
      return %pass
    else {
      echo -ac info * Invalid parameters: $!twitch_pass
  else {
    if ($0 > 1) {
      writeini twitch.ini PASS $1 $2
      echo -ac info2 * Twitch password changed for $1
    elseif ($0 == 1) {
      if ($readini(twitch.ini, n, PASS, $1)) {
        echo -ac info2 * Twitch password deleted for $1
        remini twitch.ini PASS $1
      else echo -ac info * /twitch_pass: no password found for $1
    else echo -ac info * /twitch_pass: insufficient parameters

alias twitch_nick {
  * /twitch_nick NICK
  * sets the default twitch nick

  * $twitch_nick
  * returns the default twitch nick

  if ($isid) {
    var %nick $readini(twitch.ini, n, DEFAULT, nick)
    if (!%nick) {
      var %nick $input(Default Twitch nickname:, e)
      if (%nick) {
        writeini twitch.ini DEFAULT nick %nick
        echo -ac info2 * Twitch default nickname set as %nick
        noop $twitch_pass(%nick)
    return $lower(%nick)
  else {
    if ($0 > 0) {
      writeini twitch.ini DEFAULT nick $1
      echo -ac info2 * Twitch default nickname set as $1
      noop $twitch_pass($1)
    else echo -ac info * /twitch_nick: insufficient parameters
alias is_twitch {
  * $is_twitch($cid)
  * returns $true or $false
  if ($scid($1).servertarget == $TWITCH_CONNECT_ADDRESS) || ($scid($1).server == return $true
  return $false
alias twitch_connection {
  * $twitch_connection
  * returns the $cid of the twitch connection if it's found
  * else returns $null 
  var %c $scon(0)
  while (%c) {
    if ($is_twitch($scon(%c))) return $scon(%c)
    dec %c


Sign in to comment.
sgaming   -  Jul 07, 2015

Just wondering again.. so long ago since i've used mirc :D
where do i add this again? thank you!

Yawhatnever  -  Jul 07, 2015
  • Open the script editor (alt+R)
  • Make sure you're in the remote tab
  • File > new
  • Paste the script in the editor
  • File > save as
sgaming  -  Jul 08, 2015

yeah thank you, figured it out. :D

eep up the great work! :D

Sign in to comment

Yawhatnever   -  Jul 04, 2015

Updated due to recent changes by twitch:

  • Joins, parts, and mods are now requested via CAP negotiation
  • capability is now requested to get NOTICEs (messages no longer come from jtv)
  • Extra commands are hidden
Yawhatnever   -  Aug 14, 2014

Updated to use $servertarget (introduced in mIRC 7.34) for identifying the twitch connection. The old methods for identifying the twitch connection have been removed.

I also updated the script so that passwords for multiple nicknames can be saved. You can switch between nicknames using /twitch_nick (you will also need to reconnect). Only one can be connected at a time (this is by design).

For a while a few of the IP addresses hosting twitch chat didn't have port 6667 available, so the port can also be changed more easily in the script now. Twitch chat listens on ports 80, 443, and 6667.

Yawhatnever   -  Nov 21, 2013

This link explains many of the technical differences between Twitch chat and a normal IRC server:

Some of them I've already mentioned responding to comments here.

Menteroth   -  Sep 23, 2013

you can always add a "url -an $+ $$1" for nicklist too. just like in twitch chat.

Yawhatnever  -  Sep 23, 2013

Good idea, thanks.

Menteroth  -  Sep 23, 2013

you're welcome.
don't know how much you want to add, some or everything available in twitch. there is also a command called "modcaps" for the channel. which deletes accessive caps. and then of course you have ignore in nicklist too. but like I said. don't know how much you want to add. :)

in my menu I also added a clear menu that clears both IRC and twitch chat with the same choice. if you want it to work just like in the twitch chat. since mIRC doesn't clear by that command. just a few tips if you want to add.

Yawhatnever  -  Sep 23, 2013

I wasn't aware of the modcaps command. I may add it in the future. I don't see it listed on the chat moderation commands page and I don't see any buttons for it when in the chat. Is it new?

Personally I wouldn't be clearing my own window if I were using mIRC; I'd be doing it to clear spam for other users. It's just a matter of typing /clear if somebody wants their own window cleared, so I'm going to leave that part as it is.

mIRC's built in ignore functions work fine for twitch. As you said, they're already in the nick list.

There's an r9k mode in beta testing that you might be interested in. I haven't added it, but if it's made official I will.
Commands: /r9kbeta and /r9kbetaoff

Menteroth  -  Sep 23, 2013

it might have been removed then. haven't checked lately. I added it a few months back.

yeah it's quite simple. were just thinking of new people using IRC that want it simple.

ah yeah. forgot about that.

hmm. not sure what that is. too much text to read now to try and figure out what it is. watching e-sports at the moment. :)

Sign in to comment

Yawhatnever   -  Sep 23, 2013

Twitch now requires using an OAuth token to connect. When connecting using this script, set your password as 'oauth:token'.
You can generate a token here for now:

Yawhatnever   -  Jun 24, 2013

Made a small change to make sure channel names are always lowercase (you'll have problems if they're not). Just to be sure, use /twitch instead of /join.

As a side note, mIRC's built in ignore functions work fine for Twitch.

PackardBell   -  Jun 16, 2013

yoyo. The script works: but i'm feeling it kinda useless.
Wouldn't it be better if you can set the script for a bot which sends the messages to a normal IRC network?
And that when someone type something in that chan, his message will be sent to the twitch tv with a [$nick] [msg] or something?
Cause know it kinda feels a little useless to me... :)

Yawhatnever  -  Jun 16, 2013

The purpose of this script is to simplify connecting and joining twitch channels, as well as provide the basic moderation commands (without having to memorize them).

What you describe would be a separate script with a different purpose.

im4k  -  Aug 19, 2013

Hey Ya, I like the script! It works just fine, I even fine tweaked it for myself for a few extra customization's. I'm curious, because I'm kinda script kiddy when it comes to mirc. Was wondering if you could recommend a list of all the commands/syntax that works on mirc as well as twitch chat. I want to tweak my code to work seamlessly with twitch, but I'm having trouble finding good documentation myself. Anything you could recommend? Thanks for your help!

Yawhatnever  -  Aug 19, 2013

Twitch is kind of tricky because they didn't follow many standards. Some scripts might have to be redesigned to account for not having NOTICE or colors. You'll either have to maintain separate versions of scripts if you are on other networks where they're used, or you'll have to change how it responds depending on what connection you're using. $network won't work because Twitch doesn't send the network name on connect, but you can see my workaround in the script above.

I've listed all of the moderation commands for Twitch in the script as well as given the link the the description above. As you can see, most commands are performed with /msg #channel [/.]command - It accepts either '.' or '/' as the command prefix. To perform an action you would have to do /msg #channel .me rather than just /me or /describe #channel.

Colors won't work either. You'll only see the numbers.

Connecting to chat will require an OAuth token soon.

im4k  -  Aug 19, 2013

Thanks for the info Ya, and terrific response time btw! :)

I have noticed that there's a difference between normal mIRC scripting, and what is acceptable in chat on Twitch. I especially notice it when trying to implement standard mIRC scripts and they don't seem to work at all with the Twitch chat (plus Twitch has been kinda buggy recently).

To give you some incite into what I'm doing--I'm trying to create a chat moderation bot that will support link blocking/text commands and such. Also, and the trickiest part I'm having issues with, is creating a way to reward my regular viewers.

Basically every 10 min you stay in chat you get a point/token etc, and then can use accrued points towards raffles in the stream. I need commands that can read/write to a file that keeps track of the users points (I was trying to use .ini for this, but I've read that it's not optimal when having a high viewer count, due to the constant reading/writing to the file.) <I'm not sure how true or false this is. I also need to be able to have owner/mods add/remove points on command, and let viewers !points to see what their balance is and so forth.

And then I need a command to issue a giveaway and to draw a winner from the viewers who enter, giving higher chances to the ones who bid more points/tickets. Eventually I would like to add the ability to trade points among users and have designated regulars to be able to initiate their own giveaways. Further down the road I'd like an XP system where users level up 1-100 just by watching.

I've seen several bots like these, and there's not a lot of documentation on them. Some that I've found are either coded incorrectly, or not very optimized. I'm really just trying to piece things together myself.

If you know of a good script, or just a general what to steer away from, that would be amazing!

Yawhatnever  -  Aug 19, 2013

A hash table should be fine for storing things like that. It sounds pretty straightforward; what don't you understand how to do?

This is kind of getting off topic from both the script and Twitch. If you need general help with your project, I hang around in #mSL on SwiftIRC.

im4k  -  Aug 20, 2013

Alright thanks dude, I'll pop in whenever I get stuck. Thanks for the help!

Dutchs  -  Nov 27, 2013

Pretty useful script, btw you can fix the lowercase channel name bug(not being able to join channel if it has uppercase characters) with something like: "-j $chr(35) $+ $lower($$1)" in the server command, to explain that a bit:
$chr(35) = # , $lower() should be self-explanatory and $$1 being a mandatory parameter, in contrast to $1 being optional.

Yawhatnever  -  Nov 27, 2013

I already convert channel names to lowercase as long as you use the '/twitch ' command. The # is also optional with that command, which it wouldn't be with your example. There's also no need to use $$1 because I've made it open your channel if none is specified.

Sign in to comment

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.