Updated UrbanDictionary Command 2015

By EpicStreamMan on Dec 09, 2015

Here is a Script I wanted to share for anyone out there who was looking for and updated Twitch Chat command Script to allow people to lookup stuff in UrbanDictionary. It uses JSON instead of Sockets which seems to perform better. Also has built in on/off function (MOD's only) and is setup with Global and Pre-User cooldowns to keep people from spamming it.

Make sure to go to mIRC>>Options>>Connect>>Options>>Perform...>>Enable
Then select or Add your twitch Network and add these Perform Commands:
RAW CAP REQ :twitch.tv/membership

That allows mIRC to see if a user is a MOD/op

Feel free to share or mod as you please. If you have any questions check me out on http://twitch.tc/EpicStreamMan or http://youtube.com/EpicStreamMan
Happy to help ;c)

/*
****************************************************************
** Simple Urbandicitonary Definition and Example/Usage Lookup **
****************************************************************
** Requires the JSON for mIRC http://hawkee.com/snippet/10194 **
****************************************************************
** !ud/!urban/!urbandictionary on/off/search_term_to_look_up  **
****************************************************************
*/

; ** Internal udlookup Function which uses Urbandictionsary's API to get Definition and Example/Usage of a Search Term
; ** Syntax: $udlookup(Search_Term) - Usage: $udlookup(pwnd) - Returns: Urbandictionary Definition: Tense of pwn. - Example: You just got PWND!
alias udlookup {
  JSONOpen -du lookup http://api.urbandictionary.com/v0/define?term= $+ $replace($1-,$chr(32),$chr(43))
  if ($json(lookup,list,0,definition) == $null) return No definition found.
  return Definition: $replace($remove($json(lookup,list,0,definition) - Example: $json(lookup,list,0,example),],[),$chr(10),$chr(32),</sarc>,Kappa)
  JSONClose lookup
}

; ** This lets MOD's turn on/off the !ud/!urban/!urbandictionary command
; ** Syntax: !ud/!urban/!urbandictionary on/off - Usage: !ud on - Returns: Urbandictionary has been Enabled for Channel
; ** Keeps Token List of Channels it's Enabled/Allowed to Respond in %chan variable
; **
on $*:text:/^!(urban|urbandictionary|ud) o(n|ff)$/iS:#:{
  if ($nick isop #) {
    if ($regml(2) == n) {
      if (!$istok(%chan,#,44)) {
        set %chan $addtok(%chan,#,44)
        MSG $chan Urbandictionary has been Enabled for Channel BloodTrail
      }
      else MSG $chan Urbandictionary has been Already Enabled for This Channel BrokeBack
    }
    else {
      if ($istok(%chan,#,44)) {
        set %chan $remtok(%chan,#,1,44)
        MSG $chan Urbandictionary has been Disabled for Channel BloodTrail
      }
      else MSG $chan Urbandictionary has been Already been Disabled for This Channel BrokeBack
    }
  }
  else MSG $chan Access Denied. This command is reserved for MOD's only. NotLikeThis
}

; ** Main Chat Command !ud/!urban/!urbandictionary
; ** Syntax: !ud/!urban/!urbandictionary search_term_to_look_up - Usage: !ud pwnd - Returns: Urbandictionary Definition: Tense of pwn. - Example: You just got PWND!
; ** Also setup to give a Hard Coded Answer to whatever you define in the Regular Expression on line 56 below with line 57 bypassing the Urbandictionary lookup all together.
; ** Has a Global cooldown set on line 54 of 3 secs (-u3) and a Per User cooldown on line 55 (-u10) of 10 secs
; **
on $*:text:/^[!@.](urban|urbandictionary|ud)( |$)/iS:#:{
  if ($istok(%chan,#,44)) {
    IF (!$2) { MSG $chan Usage: !UrbanDictionary [Search Term] OMGScoots
    return }
    IF ((%fud) || ($($+(%,fud.,$nick),2))) { return }
    SET -u3 %fud On
    SET -u10 %fud. $+ $nick On  
    if $regex($2-,/^(epicstreamman|epic|esm)/iS) {
      MSG $chan Urbandictionary Definition: EpicStreamMan is the Koolest, Everyone should Follow him, and Sub to his http://Youtube.com/EpicStreamMan Channel and give him all your Money cuz why not Kappa - Example: EpicStreamMan is one bad MoFo..what?! I'm just Talkin' 'bout Epic!
    }
    Else MSG $chan Urbandictionary $udlookup($2-) MrDestructoid
  }
  Else {
    IF ((%fud) || ($($+(%,fud.,$nick),2))) { return }
    SET -u15 %fud On
    SET -u30 %fud. $+ $nick On  
    MSG $chan !Urbictionary is NOT currently Enabled in this Channel NotLikeThis
  }
}

Comments

Sign in to comment.
dma   -  Dec 23, 2015

it dont work i tellya

 Respond  
EpicStreamMan   -  Dec 11, 2015

My frist attempt at mIRC Script I thought I did alright, at least it works ;c)

 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.