Chat Acronym Lookup

By napa182 on Feb 01, 2010

Just a chat acronym lookup socket
Bot version:
copy/paste into ur bot's remotes
trigger is @acro acronym

<@napa182> @acro wb
<@Sick0> wb = Write back
<@Sick0> wb = Welcome back
<@Sick0> wb = Way bored

<~napa182> @acro lol
<&Sick0> lol = Laughing out loud

<~napa182> @acro sfb
<&Sick0> sfb = S*** for brains

<~napa182> @acro lollll
<&Sick0> lollll was not found in the database.

<~napa182> @acro smh
<&Sick0> smh = Shaking my head

<~napa182> @acro smdh
<&Sick0> smdh = Shaking my d*** head

also added a dialog version of it so you can pick either one or both .
Dialog version:
pic of the dialog
Image
Rip strip or screw up this snippet anyway you see fit IDC.

/*
Bot version of the Acronym Lookup. If you want to use it as a bot trigger instead of a dialog.
*/
on $*:text:/^@acro\s(.+)$/iS:#: {
  if (!%F) { inc -u4 %F
    if ($sock(acro)) sockclose acro
    sockopen acro www.sharpened.net 80
    sockmark acro $+(/acronyms/meaning/,$remove($regml(1),$chr(32))) msg #
  }
}
on *:sockopen:acro: {
  sockwrite -n acro GET $gettok($sock(acro).mark,1,32) HTTP/1.1
  sockwrite -n acro Host: $+($sock(acro).addr,$str($crlf,2))
}
on *:sockread:acro: {
  var %acro | sockread %acro
  if ($regex(%acro,/<title>(.+Found)<\/title>/)) {
    $gettok($sock(acro).mark,2-,32) $regml(1)
    sockclose acro
  }
  if ($regex(%acro,/<th.+right">(.+?)<\/th>/)) { 
    $gettok($sock(acro).mark,2-,32) $regml(1) 
  }
}
/*
Dialog version of the Acronym Lookup. If you want to use it in a dialog instead of the bot script.
*/
dialog acro {
  title "Acronym"
  size -1 -1 83 71
  option dbu
  box "Enter Acronym", 1, 2 2 79 19
  edit "", 2, 3 10 54 9, autohs
  button "Check", 3, 57 10 22 9, flat
  box "Outcome", 4, 2 22 79 47
  list 5, 3 30 54 38, size hsbar vsbar
  button "Clear", 6, 57 31 22 9, flat
  button "Msg", 7, 57 40 22 9, flat
  button "Clip", 8, 57 49 22 9, flat
  button "Close", 9, 57 58 22 9, flat cancel
}
on *:load: { 
  echo 12 -a You Have Just Loaded Napa182's Acronym Lookup
  echo 12 -a An Irc.EzzyChat.Com Production 
}
menu menubar,channel {
  .Acronym Finder:dialog $iif($dialog(acro),-v,-md acro) acro
}
on *:dialog:acro:init:0:{ did -b $dname 3,6-8 }
on *:dialog:acro:edit:2:{ did -e $dname 3,6-8 }
on *:dialog:acro:sclick:*: {
  if ($did == 3) { 
    did -r $dname 5 
    if ($sock(acro2)) sockclose acro2 
    sockopen acro2 www.sharpened.net 80 
    sockmark acro2 $+(/acronyms/meaning/,$remove($did(2).text,$chr(32))) 
  }
  if ($did == 6) { did -r $dname 2,5 | did -b $dname 3,6-8 }
  if ($did == 7) { $iif(!$did(5).seltext,noop $input(Please Select An Acro To Message,uhod,ERROR!),msg $active $did(5).seltext) } 
  if ($did == 8) { $iif(!$did(5).seltext,noop $input(Please Select An Acro To Add To Clipboard,uhdo,ERROR!),clipboard $did(5).seltext) }
}
on *:sockopen:acro2: {
  sockwrite -nt $sockname GET $sock(acro2).mark HTTP/1.1
  sockwrite -nt $sockname Host: $+($sock(acro2).addr,$str($crlf,2))
}
on *:sockread:acro2: {
  var %acro2 | sockread %acro2
  if ($regex(%acro2,/<title>(.+Found)<\/title>/)) {
    didtok acro 5 32 $regml(1) 
    sockclose acro2 
  }
  if ($regex(%acro2,/<th.+right">(.+?)<\/th>/)) { did -az acro 5 $regml(1) }
}

Comments

Sign in to comment.
Stewie1k94   -  Oct 06, 2012

@RIcko The site seems to redirect to pc.net .. This should work for you.

on $*:text:/^@acro\s(.+)$/iS:#: {
  if (!%F) { inc -u4 %F
    if ($sock(acro)) sockclose acro
    sockopen acro pc.net 80
    sockmark acro $+(/slang/meaning/,$remove($regml(1),$chr(32))) msg #
  }
}
on *:sockopen:acro: {
  sockwrite -n acro GET $gettok($sock(acro).mark,1,32) HTTP/1.1
  sockwrite -n acro Host: $+($sock(acro).addr,$str($crlf,2))
}
on *:sockread:acro: {
  var %acro | sockread %acro
  if ($regex(%acro,/<th class="right">(.+?)</th>/)) { 
    $gettok($sock(acro).mark,2-,32) Meaning: $regml(1) 
  }
}
 Respond  
RIcko   -  Sep 01, 2012

Script stopped working for some reason.

 Respond  
Jethro   -  Mar 06, 2011

Conscious, I see napa has had this snippet updated last month. It might have been a silly blunder.

 Respond  
Conscious   -  Mar 05, 2011

" .Acronym Finder:dialog $iif($dialog(acro),-v,-md acro)acro"
should be
" .Acronym Finder:dialog $iif($dialog(acro),-v,-md acro) acro"

Otherwise it doesn't work.
(the menu bit)

 Respond  
Dark|   -  Nov 29, 2010

Your welcome xD
if anymore of your snippets stop working ill let you know

 Respond  
napa182   -  Nov 29, 2010

You are welcome, and thank you for letting me know it stopped working.

 Respond  
Dark|   -  Nov 29, 2010

Works
Thank you

 Respond  
napa182   -  Nov 29, 2010

ok updated

 Respond  
Dark|   -  Nov 29, 2010

Alright, Thanks :)

 Respond  
napa182   -  Nov 29, 2010

yeah the html changed on the site il fix it in a min.

 Respond  
Dark|   -  Nov 29, 2010

Napa, this isnt working for me :/
it wont tell what LOL means
11(Mon/03:08:43 PM) <@Dark|Home> @acro lol
the bot says nothing

 Respond  
slub77   -  Feb 03, 2010

haha lol, nice, i new you kind of cared lol

 Respond  
napa182   -  Feb 03, 2010

Edited: added the dialog version of it to the snippet.

 Respond  
Battlemonkey   -  Feb 02, 2010

Right... 'Quick'.

 Respond  
napa182   -  Feb 02, 2010

sure you can. what do i care... lol

 Respond  
slub77   -  Feb 02, 2010

i just started dialogs, i wana combine them.

can i make that into a dialog? lol

 Respond  
sunslayer   -  Feb 02, 2010

yus, teach slub77 sockets. kids walk home.

 Respond  
slub77   -  Feb 02, 2010

when u went and picked your kids up, and left me hanging lol

 Respond  
napa182   -  Feb 02, 2010

when did i say i wouldn't?

 Respond  
slub77   -  Feb 02, 2010

dude why won't you teach me sockets >.<

 Respond  
napa182   -  Feb 02, 2010

you picky sob ;x
i removed the spaces from the $regml(1) so it will still work if you spaced the acros why would you space them idk but w/e

 Respond  
SnoooP   -  Feb 02, 2010

Who types B R B.. ? L M A O... :S

 Respond  
Gummo   -  Feb 02, 2010

Yeah, but if someone does happen to say something with a space in it, it will lie and not tell them the answer from the website.
e.g. "B R B = Be"

 Respond  
sunslayer   -  Feb 02, 2010

isnt the point of an acronym to be one word tho?

 Respond  
Gummo   -  Feb 02, 2010

Your regex will allow for multiple words as the search query, while the actual code only uses the first word. Edit: To clarify, it also puts all the words into the sockmark.
Your regex should probably instead be:

/^@acro\s(\S+)$/iS

Or perhaps simply remove spaces from $regml(1) when you create the sockmark.

 Respond  
napa182   -  Feb 01, 2010

yeah true i didn't spend to much time on the code..
thanks for catching my slip..
;x

 Respond  
sunslayer   -  Feb 01, 2010

instead of using 2 diff regex

/<td><b><font size="2">(.+?)<\/font>/

works for both

 Respond  
napa182   -  Feb 01, 2010

ah thank you Jethro_

i like to use it as an alias an have it echo the results.

 Respond  
Jethro   -  Feb 01, 2010

Thanks for another handy distribution of napa socket collection. This is actually pretty useful, as it makes $replace or $reptok look bad...lol It's also convenient to seek out the meanings of acronym that we don't know or understand. Perhaps it's even better to automatically replace any acronym with the actual word itself upon typing as an option.

 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.