Advertisement
tduva

mIRC/Twitch Chat

Jun 3rd, 2016
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.35 KB | None | 0 0
  1. ; Notes on using mIRC with Twitch Chat
  2. ;=====================================
  3. ; Twitch Chat documentation: https://github.com/justintv/Twitch-API/blob/master/IRC.md
  4.  
  5. ; Automatically enable CAPs on connect (comment out or remove what you don't need)
  6.  
  7. on *:connect:{
  8.   if ($server == tmi.twitch.tv) {
  9.     raw CAP REQ :twitch.tv/tags
  10.     raw CAP REQ :twitch.tv/commands
  11.     raw CAP REQ :twitch.tv/membership
  12.   }
  13. }
  14.  
  15. ; Using IRCv3 Tags
  16. ;-----------------
  17. ; A lot of Twitch messages have useful tags attached to them when you request the tags capability. mIRC provides the $msgtags identifier to retrieve that info.
  18. ;
  19. ; Examples
  20.  
  21. alias isSub {
  22.   if ($msgtags(subscriber).key == 1) {
  23.     return $true
  24.   }
  25.   return $false
  26. }
  27.  
  28. ; Detect Timeouts/Bans
  29. ;---------------------
  30. ; The CLEARCHAT command that Twitch sends (when you have the commands capability enabled) is a custom one, so mIRC doesn't know how to handle it. You have to use a raw event handler for that.
  31.  
  32. raw CLEARCHAT:*:{
  33.   ; $1 - channel
  34.   ; $2 - user who got timed out/banned
  35.  
  36.   ; You need to have the tags capability requested to get tags
  37.   if ($msgtags(ban-duration).key == $null) {
  38.     ; If ban-duration is missing it is a ban
  39.     echo -a user $2 in $1 was banned
  40.   }
  41.   else {
  42.     ; Otherwise it's a timeout
  43.     echo -a user $2 in $1 was timed out for $msgtags(ban-duration).key seconds
  44.   }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement